strange behaviour with keyword arguments and inheritance

livibetter livibetter at gmail.com
Mon Apr 16 21:36:21 EDT 2007


On Apr 17, 8:56 am, "matthewperpick" <matthewperp... at gmail.com> wrote:
> Check out this toy example that demonstrates some "strange" behaviour
> with keyword arguments and inheritance.
>
> =================================
>
> class Parent:
>     def __init__(self, ary = []):
>         self.ary = ary
>

This should work:

class Parent:
    def __init__(self, ary = []):
        self.ary = list(ary)

And FYI
http://groups.google.com/group/comp.lang.python/browse_thread/thread/e203f9cd64125a78/8d89b250ceca1458#8d89b250ceca1458




More information about the Python-list mailing list