What do you call a class not intended to be instantiated

Aaron "Castironpi" Brady castironpi at gmail.com
Mon Sep 22 16:15:46 EDT 2008


On Sep 22, 2:38 pm, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> Aaron "Castironpi" Brady a écrit :
>
>
>
> > On Sep 22, 8:45 am, "Tim Rowe" <digi... at gmail.com> wrote:
> >> 2008/9/22 Bruno Desthuilliers <bruno.42.desthuilli... at websiteburo.invalid>:
>
> >>>> Sounds to me like a functor, aka a function object:
> >>>>http://en.wikipedia.org/wiki/Function_object
> >>> Ok, then the simple solution is to implement a callable type (__call__
> >>> method), possibly with appropriate support for the descriptor protocol if
> >>> it's meant to be usable as a method.
> >> Yes -- and instantiate the thing and keep the state in the instance,
> >> rather than keeping the state in the class, so that it's possible to
> >> safely have more than one of them if a later design change calls for
> >> it (probably what led people off onto the sidetrack of thinking a
> >> singleton was called for).  That's the classic way of implementing a
> >> "class [to be] used as a function".
>
> >> --
> >> Tim Rowe
>
> > I think you are either looking for a class that has a generator, or a
> > generator that has a reference to itself.
>
> ???
>
> Going back to robot-mode, Aaron ?

Not getting the same sense of "soul" as from my usual posts.  I guess
so.  Might even drop the name change, too... while I'm at it.  One
more word from you about it and I'm starting a thread, and calling it,
"Python and my sense of 'soul'".  Ha ha.



More information about the Python-list mailing list