What do you call a class not intended to be instantiated

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun Sep 21 19:42:11 EDT 2008


Steven D'Aprano:
> 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.

You may use a module too for that, with normal functions inside, plus
module variables that keep the state. Modules can't be instantiated, I
think.

Bye,
bearophile



More information about the Python-list mailing list