Thanks a lot. I'll try give it a go and see if it helps.

On Sun, Aug 8, 2010 at 6:28 PM, Tim Harig <user...@ilthio.net> wrote:
> It is not so much using __init__() that makes the difference as it what
> scope the variables are assigned to.  If you define them as you where, then
> the variables are associated with the class object itself.  If the variable
> is a mutable type, and you change it in one instance, it actually changes
> it in the class object which means it also changes for all of the
> instances.
>
> I used the constructor because it gives me a reference to the newly created
> instance object "self".  I then assign the variables to self, which
> assignes them to the newly created instance object.  Then each instance has
> its own separate a and b variables that will not change when the variables
> are changed inside of another instance object.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to