A function's local namespace is signalled by the "<locals>" component
This commit is contained in:
parent
779cba823d
commit
5ccb5c0939
|
@ -64,7 +64,8 @@ functions and classes. For top-level functions and classes, the
|
|||
``__qname__`` attribute is equal to the ``__name__`` attribute. For
|
||||
nested classed, methods, and nested functions, the ``__qname__``
|
||||
attribute contains a dotted path leading to the object from the module
|
||||
top-level.
|
||||
top-level. A function's local namespace is represented in that dotted
|
||||
path by a component named ``<locals>``.
|
||||
|
||||
The repr() and str() of functions and classes is modified to use
|
||||
``__qname__`` rather than ``__name__``.
|
||||
|
@ -96,7 +97,7 @@ Example with nested functions
|
|||
>>> f.__qname__
|
||||
'f'
|
||||
>>> f().__qname__
|
||||
'f.g'
|
||||
'f.<locals>.g'
|
||||
|
||||
|
||||
Limitations
|
||||
|
|
Loading…
Reference in New Issue