Il 23 May 2007 04:07:19 -0700, Siah ha scritto:

> Ready to go insane here. Class A, taking on a default value for a

__init__ is a function, taking a default value of [], which is a list,
which is a mutable object. That said, you should remember that this means
that such default value is 'shared' between all instances. If you don't
want that, do something like:

def __init__(self, defaultvalue=None):
        if defaultvalue is None:
                defaultvalue=[]

http://docs.python.org/tut/node6.html#SECTION006710000000000000000


-- 
Alan Franzoni <[EMAIL PROTECTED]>
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to