Classes and modules are singletons?

castironpi at gmail.com castironpi at gmail.com
Thu Mar 6 17:30:14 EST 2008


On Mar 6, 2:57 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Thu, 06 Mar 2008 11:06:50 -0800, castironpi wrote:
> > On Mar 6, 8:30 am, Carl Banks <pavlovevide... at gmail.com> wrote:
> >> 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
>
> > ?
>
> You are really a bit thick, a troll, or a bot.

The point was, that's one difference between classes and modules: you
can't reload classes plonk.



More information about the Python-list mailing list