I'd like to be able to extend a class without inheriting one of the class variables.
Given this scenario:
class A:
aliases=['a','ay']
class B(A):
pass
print(B.aliases)
I would rather get an error that B has not defined the aliases
variable rather than have B
accidentally called ay
.
One could imagine a solution where aliases becomes a member of the instantiated object (self.aliases
) and is set in __init__
but I really want to be able to access the aliases using the cls
object rather than an instance of the class.
Any suggestions?