How to avoid "f.close" (no parens) bug?
Batista, Facundo
FBatista at uniFON.com.ar
Wed Feb 11 11:30:16 EST 2004
Richard Brodie wrote:
#- If you can't retrofit a 'getattr' method on an attribute in
#- this way, you are likely
#- to specify get methods in your stable APIs to start with.
#- Then you'll have code that
#- looks more like Java: A.getB().getC().getD() instead of A.B.C.D
I'm ok to use getattr, or properties.
And it's ok to have something like:
class Test:
def __getattr__(self, name):
print "Nobody expects the %s!" % name
t = Test()
t.spanish_inquisition = 5
newvar = t.spanish_inquisition
But, what's the point to have a...
t.spanish_inquisition
...alone?
What I'm trying to say is: If you're not executing any code (no function
call) and you're not doing any assingment, what's the point of that line?
. Facundo
More information about the Python-list
mailing list