What do you call a class not intended to be instantiated

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Mon Sep 22 04:11:58 EDT 2008


Steven D'Aprano a écrit :
> I have a class which is not intended to be instantiated. Instead of using 
> the class to creating an instance and then operate on it, I use the class 
> directly, with classmethods. Essentially, the class is used as a function 
> that keeps state from one call to the next.
> 
> The problem is that I don't know what to call such a thing! "Abstract 
> class" isn't right, because that implies that you should subclass the 
> class and then instantiate the subclasses.
> 
> What do you call such a class?
> 

<nitpick>
Err... A possible design smell ?-)
</nitpick>


More seriously: this looks quite like a singleton, which in Python is 
usually implemented way more simply using a module and plain functions.

Do you have a use case for specializing this class ?




More information about the Python-list mailing list