Objects, lists and assigning values

Manuel Graune manuel.graune at koeln.de
Fri Apr 6 03:23:53 EDT 2007


Hello Gabriel, hello William,

thanks to both of you for your answers. I seem to need a
better book about python. 

Regards,

Manuel

"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> writes:

> class new_class(object):
>     def __init__(self, internal_list=None):
>         if internal_list is None:
>             internal_list = []
>         self.internal_list= internal_list
>
> See
> http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm
>
> -- 
> Gabriel Genellina
>

-- 
A hundred men did the rational thing. The sum of those rational choices was
called panic. Neal Stephenson -- System of the world
http://www.graune.org/GnuPG_pubkey.asc
Key fingerprint = 1E44 9CBD DEE4 9E07 5E0A  5828 5476 7E92 2DB4 3C99



More information about the Python-list mailing list