The Voidspace Techie Blog

Actually, 'print' is just fine as an object attribute, and doesn't need a getter method; getattr(ob,'print') works just fine, as does setattr(ob,'print'). It's still only One Way, it's just that you have to syntactically escape certain attribute names as getattr(ob,'name') instead of as ob.name.


So you have to use two different ways of doing the same thing, but it's still only one way - right ?

I know what you mean, but that *still* doesn't get round the problem of having to avoid your *real* attributes and members. You either have to provide an alternative way (getter/setter) or just hope no one wants to use your attribute/method names as keywords. Much better to keep them separate IMHO.

Fuzz


Name:

Email:

URL:

Comment:  ? 

 

Commenting by HaloScan