The binding operator, and what gets bound to what
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Fri Dec 5 07:34:04 EST 2014
More information about the Python-list mailing list
Fri Dec 5 07:34:04 EST 2014
- Previous message (by thread): The binding operator, and what gets bound to what (was: About Modifying Globals)
- Next message (by thread): The binding operator, and what gets bound to what
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ned Batchelder wrote: > On 12/5/14 4:53 AM, Steven D'Aprano wrote: >> Oh, I learned something new: strictly speaking, this is implementation- >> dependent and not guaranteed to work in the future! >> >> def func(): >> global math >> import math > > I don't think this is implementation-dependent. The docs say that it is: https://docs.python.org/3/reference/simple_stmts.html#the-global-statement Names listed in a global statement MUST NOT [emphasis added] be defined as formal parameters or in a for loop control target, class definition, function definition, or import statement. CPython implementation detail: The current implementation does not enforce the two restrictions, but programs should not abuse this freedom, as future implementations may enforce them or silently change the meaning of the program. -- Steven
- Previous message (by thread): The binding operator, and what gets bound to what (was: About Modifying Globals)
- Next message (by thread): The binding operator, and what gets bound to what
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list