Emulating Final classes in Python

Erik python at lucidity.plus.com
Tue Jan 17 04:54:21 EST 2017


Hi Steven,

On 17/01/17 07:05, Steven D'Aprano wrote:
> I wish to emulate a "final" class using Python, similar to bool:

[snip]

> It doesn't have to be absolutely bulletproof, but anyone wanting to subclass my
> class should need to work for it, which hopefully will tell them that they're
> doing something unsupported.

When someone brings up something like this you usually quote the 
"consenting adults" argument, so I'll throw it back at you - why not 
just add it to your documentation?

E.


More information about the Python-list mailing list