s some "strange" behaviour
> > with keyword arguments and inheritance.
>
> > =
>
> > class Parent:
> > def __init__(self, ary = []):
> > self.ary = ary
>
> [snip]
>
> As pointed out earlier, default va
matthewperpick 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
>
[s
matthewperpick a écrit :
> Check out this toy example that demonstrates some "strange" behaviour
> with keyword arguments and inheritance.
Nope. It demonstrates that default arguments are eval'd only once (when
the def statement is eval'd), which is documented and
Steve Holden <[EMAIL PROTECTED]> wrote:
...
> > livibetter has a better solution. the reason is that you need to
> > create a new list object everytime, am I right?
> >
> Yes, specifically on every *call*.
...and livibetter's solution also creates a new list on every call to
Child (that [] pas
[EMAIL PROTECTED] wrote:
> On Apr 17, 9:36 am, livibetter <[EMAIL PROTECTED]> wrote:
>> On Apr 17, 8:56 am, "matthewperpick" <[EMAIL PROTECTED]> wrote:
>>
>>> Check out this toy example that demonstrates some "strange&qu
On Apr 17, 9:36 am, livibetter <[EMAIL PROTECTED]> wrote:
> On Apr 17, 8:56 am, "matthewperpick" <[EMAIL PROTECTED]> wrote:
>
> > Check out this toy example that demonstrates some "strange" behaviour
> > with keyword arguments and inheritance.
&
On Apr 17, 8:56 am, "matthewperpick" <[EMAIL PROTECTED]> wrote:
> Check out this toy example that demonstrates some "strange" behaviour
> with keyword arguments and inheritance.
>
> =
>
> class Parent:
> def __i
On Apr 17, 8:56 am, "matthewperpick" <[EMAIL PROTECTED]> wrote:
> Check out this toy example that demonstrates some "strange" behaviour
> with keyword arguments and inheritance.
>
> =
>
> class Parent:
> def __i
Check out this toy example that demonstrates some "strange" behaviour
with keyword arguments and inheritance.
=
class Parent:
def __init__(self, ary = []):
self.ary = ary
def append(self):
self.ary.append(1)
class Child(Parent