namespace the place where variable is stored namespaces are implemented as dictionaries there are the localglobal and built-in namespaces as well as nested namespaces in objects (in methodsnamespaces support modularity by preventing naming conflicts for instancethe functions builtins open and os open(are distinguished by their namespaces namespaces also aid readability and maintainability by making it clear which module implements function for instancewriting random seed(or itertools islice(makes it clear that those functions are implemented by the random and itertools modulesrespectively namespace package pep package which serves only as container for subpackages namespace packages may have no physical representationand specifically are not like regular package because they have no __init__ py file see also module nested scope the ability to refer to variable in an enclosing definition for instancea function defined inside another function can refer to variables in the outer function note that nested scopes by default work only for reference and not for assignment local variables both read and write in the innermost scope likewiseglobal variables read and write to the global namespace the nonlocal allows writing to outer scopes new-style class old name for the flavor of classes now used for all class objects in earlier python versionsonly new-style classes could use python' newerversatile features like __slots__descriptorsproperties__getattribute__()class methodsand static methods object any data with state (attributes or valueand defined behavior (methodsalso the ultimate base class of any new-style class package python module which can contain submodules or recursivelysubpackages technicallya package is python module with an __path__ attribute see also regular package and namespace package parameter named entity in function (or methoddefinition that specifies an argument (or in some casesargumentsthat the function can accept there are five kinds of parameterpositional-or-keywordspecifies an argument that can be passed either positionally or as keyword argument this is the default kind of parameterfor example foo and bar in the followingdef func(foobar=none)positional-onlyspecifies an argument that can be supplied only by position python has no syntax for defining positional-only parameters howeversome built-in functions have positionalonly parameters ( abs()keyword-onlyspecifies an argument that can be supplied only by keyword keyword-only parameters can be defined by including single var-positional parameter or bare in the parameter list of the function definition before themfor example kw_only and kw_only in the followingdef func(arg*kw_only kw_only )var-positionalspecifies that an arbitrary sequence of positional arguments can be provided (in addition to any positional arguments already accepted by other parameterssuch parameter can be defined by prepending the parameter name with *for example args in the followingdef func(*args**kwargs)var-keywordspecifies that arbitrarily many keyword arguments can be provided (in addition to any keyword arguments already accepted by other parameterssuch parameter can be defined by prepending the parameter name with **for example kwargs in the example above parameters can specify both optional and required argumentsas well as default values for some optional arguments