Style question - defining immutable class data members

Rhodri James rhodri at wildebst.demon.co.uk
Tue Mar 17 00:28:20 CET 2009


On Mon, 16 Mar 2009 09:31:59 -0000, Aaron Brady <castironpi at gmail.com>  
wrote:
[snippety snip]
> Otherwise, either /1, every instance has its own entries for class
> functions, and subsequent changes to the class don't affect existing
> instances, or /2, every method call is of the form x.__class__.foo
> ( ).  They're both bad.  (...unless that's a false dilemma.)

I must admit I was envisaging a horribly inefficient (in space terms)
version of (1) in which the instance entries were binding stubs that
referenced the class entries, but that still falls over when new
methods get dynamically added to the class.  I blame having two hours
of sleep in three days for this particular bit of dimness, sorry.

> P.S.  Do you pronounce 'wildebeeste' like 'vildebeeste'?

No, with a "w" not a "v".  It's just one of those titles that
stick with you no matter what you do.

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list