type annotation vs working code

Chris Angelico rosuav at gmail.com
Wed Oct 4 02:41:24 EDT 2023


On Wed, 4 Oct 2023 at 15:27, dn via Python-list <python-list at python.org> wrote:
> - should the class have been called either;
>
>      class SomethingSingleton():
>
> or a Singleton() class defined, which is then sub-classed, ie
>
>      class Something( Singleton ):
>
> in order to better communicate the coder's intent to the reader?

TBH, I don't think it's right to have a Singleton class which is
subclassed by a bunch of different singletons. They aren't really
subclasses of the same class. I could imagine Singleton being a
metaclass, perhaps, but otherwise, they're not really similar to each
other.

ChrisA


More information about the Python-list mailing list