Python class strangeitude
tjreedy at udel.edu
Sun Aug 25 08:48:59 CEST 2002
"Mr. Neutron" <nicktsocanos at charter.net> wrote in message
news:pan.2002.08.24.15.54.21.956955.4676 at charter.net...
> I have discovered a strange thing about Python. I have a class,
> call it MyClass. MyClass is derived from MyClassBase.
> Now I do this
> Jimmy = MyClass(...)
> Randy = MyClass(...)
> And guess what? Jimmy and Randy are the same darn thing in memory! I
> assuming that classes in Python were like in C++ in the way they
If you write a class as a singleton class, this is the normal and
usually desired behavior. Hard to do by accident though....
More information about the Python-list