[Python-ideas] Allow "assigning" to Ellipse to discard values.

Nick Coghlan ncoghlan at gmail.com
Wed Feb 11 08:00:56 CET 2015


On 11 February 2015 at 08:44, Andrew Barnert
<abarnert at yahoo.com.dmarc.invalid> wrote:
> But does Python actually guarantee that a variable will be alive until the end of the scope even if never referenced?

Yes, due to the way namespace semantics are defined. Bound names are
always referenced from the local namespace (so locals() can return
them), even if nothing visible to the compiler looks them up. That
reference doesn't go away until the namespace does.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list