Style question - defining immutable class data members
matthew at woodcraft.me.uk
Sun Mar 15 21:58:16 CET 2009
"Rhodri James" <rhodri at wildebst.demon.co.uk> writes:
> But do you, though? The only occasion I can think of that I'd want
> the search to go past the instance is this "auto-initialisation",
> and frankly I'd rather do that in an __init__ anyway. Perhaps
> static methods or class methods work that way, I don't know how
> the innards of the interpreter handle that.
> Is there any actual advantage to self.attribute picking up
> Class.attribute instead of raising a NameError?
You use that any time you call an ordinary method using syntax like
More information about the Python-list