annoying behavior

Peter Hansen peter at engcorp.com
Tue Sep 28 13:08:40 EDT 2004


Elbert Lev wrote:
> # here is the problem I ran into:
[code that uses a name before it's bound to anything]
> #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. 
> # Are there any plans to relax this restriction? 
> # In 3.0 :)?

Uh, what feature?  You have a bug in your code.  What
you showed is *no* different than doing this and
expecting something other than an error:

 >>> print x
 >>> x = 5

Please explain in more detail why you think this
shouldn't be giving an error, and what output you
think it should have given you.

-Peter



More information about the Python-list mailing list