On Mar 6, 8:30 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 5, 8:44 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > But what about classes? Are they singletons? Obviously classes aren't > > Singleton classes, that is, given an arbitrary class C you can create > > multiple instances of C. But what about class objects themselves? I've > > found a few odd references to "classes are singletons", but nothing in > > the language reference. > > Probably because "singleton" is the wrong word. A singleton means > there is one instance of a type; classes are instances of "type" which > can have many instances so classes are not singletons. > > Anyway, the answer to what you are probably asking is No. Try this: > > >>>import module > >>>c1 = module.Someclass > >>>reload(module) > >>>c2 = module.Someclass > >>>c1 is c2
What about >>> o= object() >>> b1= o.someattr >>> reload( o ) >>> b2= o.someattr >>> b1 is b2 ? -- http://mail.python.org/mailman/listinfo/python-list