Bizarre behavior with mutable default arguments

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Dec 31 02:35:44 EST 2007


En Mon, 31 Dec 2007 05:01:51 -0200, Steven D'Aprano  
<steve at REMOVE-THIS-cybersource.com.au> escribió:
> On Sun, 30 Dec 2007 20:00:14 -0800, bukzor wrote:
>
>> I also see this as the main use of the
>> 'notlocal' keyword to be introduced in py3k (it also fixes the example
>> given by Istvan above).
>
> There doesn't appear to be any reference to a "notlocal" keyword in
> Python 3 that I can find. Have I missed something? It sounds like an
> April Fool's gag to me. Do you have a reference to a PEP or other
> official announcement?

No, it's a real keyword in python 3, but it's spelled "nonlocal".
See http://www.python.org/dev/peps/pep-3104/

-- 
Gabriel Genellina




More information about the Python-list mailing list