is a variable without or with a default value within a function header to receive zero or more arguments.
is a general term to cover required, optional, positional-or-keyword, positional-only, keyword-only, var-positional and var-keyword parameter.
E.g. def func(x, y = 3.14) -> None: ....
I specifically use the term parameter for a function to receive values so I don't generally use it to also cover type parameter.
required parameter
is one which must receive an argument.
E.g. def func(x) -> None: ....
optional parameter
is one which may receive an argument.
E.g. def func(x = 100) -> None: ....
positional-or-keyword parameter (PK)
is one to receive a positional or keyword argument.
E.g. def func(x) -> None: ....
positional-only parameter (PO)
is one to receive a positional argument.
E.g. def func(x, /) -> None: ....
keyword-only parameter (KO)
is one to receive a keyword argument.
E.g. def func(*, x) -> None: ....
var-positional parameter (VP)
is one with a preceding unpack operator, e.g. *args to flexibly receive zero or more positional arguments as a tuple so the type is tuple.
is an optional parameter with the immutable default value () so the default value () cannot be changed with =.
E.g. def func(*args) -> None: ....
By convention, *args is used but other names can also be used like *teachers, *students, etc.
All the parameters after *args become keyonlyparams.
Only one *args can be used within a function header.
var-keyword parameter (VK)
is one to flexibly receive zero or more keyword arguments as a dictionary.
is an optional parameter with the immutable default value {} so the default value {} cannot be changed with =.
E.g. def func(**kwargs) -> None: ....
By convention, **kwargs is used but other names can also be used like **teachers, **students, etc.
Only one **kwargs can be used within a function header.
argument
is a value passed to a parameter.
parameter type specification (paramtypespec)
is code to specify the types and order of parameters.
can also be called parameter specification(ParamSpec) but I use parameter type specification(paramtypespec) because it's more specific and there is no special reason to camelcase the abbreviation.
parameter type specification operator (paramtypespec operator)
is ** to receive a parameter type specification:
# E.g.
classCls[**P]:...v:Cls[[int,str]]
only exists to receive a parameter type specification but not to unpack it.
isn't an unpack operator.
can also be called parameter specification operator(ParamSpec operator) but I use parameter type specification operator(paramtypespec operator) because it's more specific and there is no special reason to camelcase the abbreviation.
Python core (PyCo)
is the Python's engine which consists of bytecode compiler(BC) and virtual box(VB) to repeat the cycle BC ➝ VM.
can also be called Python interpreter(PyIn) but I use Python core because the interpreter of Python interpreter isn't very distinct from the compiler of bytecode compiler, which is confusing.
bytecode compiler (BC)
is a component of PyCo to check the syntax of Python code, then to compile the Python code into bytecode at compile time.
virtual machine (VM)
is a component of PyCo to run the bytecode compiled by bytecode compiler.
contains garbage collector.
infers dynamic types.
garbage collector
is a component of virtual machine to free the memory of no longer-used objects.
works in the background at runtime.
Python core time (ptime)
is the total time of compile time and runtime.
compile time (ctime)
is the time when bytecode compiler is compiling Python code into bytecode.
runtime (rtime)
is the time when VM is running the bytecode compiled by BC.
can also be called execution time, running time, etc but I use runtime because it's shorter.
pre-Python core time (pptime)
is the time before ptime to check Python code with type checkers, linters, etc.
can also be called static analysis time but I use pre-Python core time(pptime) because the abbreviations pptime and ptime are a good combination.
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Top comments (0)