Bug in python!? persistent value of an optional parameter in function!

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 8 03:56:37 CET 2007

En Wed, 07 Mar 2007 23:39:21 -0300, C Barr Leigh <cpblPublic at gmail.com>  

> Help! Have I found a serious bug?

Not at all! This is by design.

> def testPersistence(anarg,twooption=[]):
>     #print anarg
>     if not twooption:
>         twooption.append('Set within test for '+anarg)


Gabriel Genellina

More information about the Python-list mailing list