Final classes like in java???

Gordon McMillan gmcm at
Tue Nov 16 22:00:23 CET 1999

Arinte writes:

> Is there a way you can define your python class to be final or not able to
> be inherited from?

You could deter subclassing, but not prevent it (I can always 
rebuild my class's __bases__ to include your Final class).

Final in Java is there for efficiency. There would be no gains in 
Python since the compiler has no role in choosing the override.

- Gordon

More information about the Python-list mailing list