annoying behavior

Dave Brueck dave at pythonapocrypha.com
Tue Sep 28 13:13:11 EDT 2004


Elbert Lev wrote:
> # here is the problem I ran into:
 >
 > class foo:
 >     def __init__(self, host):
 >         self.f()
 >         self.r = True
[snip code using attribute before it existed]
> #here is the output:
> #AttributeError: foo instance has no attribute 'r'
> 
> # I understand why does this happen, but, to tell the truth,
> # this feature is very annoying.

This "feature" is pretty useful! :)

> # Are there any plans to relax this restriction? 
> # In 3.0 :)?

Goodness, I sure hope not! (and I doubt it too) What behavior do you have in 
mind? Anything different than the current behavior would be confusing/misleading 
and would hide bugs like the one you encountered.

-Dave



More information about the Python-list mailing list