Included notation in Python function arguments


nums = [1,2,3]
sum(2*x for x in nums) 

I didn't know that I could write it, so I made a note.

Actually

(2*x for x in nums) 

Is created and passed to the function,

sum((2*x for x in nums))

Same as.

Recommended Posts

Included notation in Python function arguments
About function arguments (python)
Python: About function arguments
Class notation in Python
Automatically register function arguments to argparse in Python
Create a function in Python
Use callback function in Python
ntile (decile) function in python
Receive runtime arguments in Python 2.7
Convert CIDR notation in Python
Nonlinear function modeling in Python
Draw implicit function in python
Immediate function in python (lie)
Function argument type definition in python
python function ①
[Python] function
Write AWS Lambda function in Python
Measure function execution time in Python
Function synthesis and application in Python
python function ②
[Python] Function arguments * (star) and ** (double star)
Precautions when giving default values to arguments in Python function definitions
Display LaTeX notation formulas in Python, matplotlib
Precautions when pickling a function in python
OR the List in Python (zip function)
Decompose command arguments in one line in Python
Combine python function arguments into one variable
Basic grammar of Python3 system (included notation)
Quadtree in Python --2
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
python enumerate function
Meta-analysis in Python
Unittest in python
Python> function> Closure
Epoch in Python
Discord in Python
[Python] Generator function
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Python> function> Inner function
Csv in python
Disassemble in Python
Reflection in Python
Duality in function