PEP 285: Adding a bool type

Alex Martelli aleax at aleax.it
Mon Apr 8 06:37:24 EDT 2002


Bengt Richter wrote:

> On 7 Apr 2002 13:43:29 -0400, aahz at pythoncraft.com (Aahz) wrote:
> [...]
>>
>>Assignments in expressions will never happen.
>>
> I guess you mean they won't be spelled concisely ;-)
> 
>  >>> a='eigh'
>  >>> a
>  'eigh'
>  >>> locals().__setitem__('a','bee') and 0 or a
>  'bee'

Now try that same, identical expression inside a 
function, will you...?

You can't assume locals() is modifiable at all:
attempts to modify it may fail silently and/or
they may raise exceptions ("undefined behavior").


Alex






More information about the Python-list mailing list