Tom Plunket wrote:
>> if you want separate instances to use separate objects, make sure you
>> create new objects for each new instance. see Tim's reply for how to
>> do that.
>
> kath's response is probably better.
so what's the practical difference between
def __init__(self, name):
self.name = name
self.data = []
and
def __init__(self, name):
self.name = name
self.data=[]
?
> In Python, you don't define the instance members in the class scope
> like the OP has done:
the OP's approach works perfectly fine, as long as you understand that
class attributes are shared.
</F>
--
http://mail.python.org/mailman/listinfo/python-list