ahart wrote:
> I thank you all for your help and suggestions. I wasn't aware that
> default values were considered class (static) values. That seems a
> little odd to me, but as long as I know that's the case, I'll be fine.
It's all very simple and regular: Things in the class scope
is shared betw
ahart wrote:
> Diez, Scott, and Bruno,
>
> I thank you all for your help and suggestions. I wasn't aware that
> default values were considered class (static) values.
These are *not* 'default values'. Defining a name in the body of a class
statement bind that name to the *class*. To bind a name to
Diez, Scott, and Bruno,
I thank you all for your help and suggestions. I wasn't aware that
default values were considered class (static) values. That seems a
little odd to me, but as long as I know that's the case, I'll be fine.
I initialized my list member in the __init__() method and all is
wor
ahart a écrit :
> I'm pretty new to python and am trying to write a fairly small
> application to learn more about the language. I'm noticing some
> unexpected behavior in using lists in some classes to hold child
> objects. Here is some abbreviated code to help me explain.
>
> ###
ahart wrote:
> I'm pretty new to python and am trying to write a fairly small
> application to learn more about the language. I'm noticing some
> unexpected behavior in using lists in some classes to hold child
> objects. Here is some abbreviated code to help me explain.
>
> When I run this script
>
> Apparently, the p1 instance somehow thinks that the i3 instance is in
> its list. The i3 instance should instead be in the list for p2. By the
> way, when I call the __str__() method of p2, I get the same results as
> when I do it for p1. The list appears to be acting as if it were a
> static