function family
- is a general term for function, method, generator and lambda.
function
- is a statement which can do a specific task, reusing and reducing code and whose type is
func. - creates a function object which can be called and used:
- A function object is already created by a function itself so that we can recall and reuse the existing function object multiple times without creating a new one so a function object is always one for one function.
- must have a
def, identifier,():and its body code. - can have zero or more parameters and return statements.
- can have one or more pass statements, return statements and values to do nothing, returning
None. - can be assigned a variable, function and class to.
- can be defined a variable, function and class in.
- can be written in one line.
- can be indirectly assigned to a variable and parameter but not directly.
- and parameter name can have letters,
_, the digits except for the 1st character and can be a reserved soft keyword but cannot start with a digit and cannot be a reserved keyword and should be lower_snake_case. function definition
- is a guide to how to write a function.
function header
- is the beginning code of function family members until and including "
:":- E.g.
async def func(x: int=100, y:float=3.14) -> None:.
- E.g.
function signature
- is a function header excluding
async,def,lambda, its name and ":":- E.g.
(x: int=100, y:float=3.14) -> None.
- E.g.
- can be got by inspect.signature.
Top comments (0)