Unexpected Python Behavior

Fernando Perez fperez528 at yahoo.com
Tue Oct 5 02:16:31 CEST 2004


Andrew Dalke wrote:

> Fernando Perez wrote:
>> Sorry to pitch in late, and forgive me if this has already been discussed

> 
> It was discussed.  Here's Alex's comments
> 
> ] def f(x):
> ]     if x in f.cache: ...
> ] f.cache = []
> ]
> ] which among other things suffers from f.cache having to be
> ] used in spots that come lexically before it's defined; or
> ] a decorator equivalent:

Ah, thanks for the pointer.  The thread seemed long and heated, so I skimmed it
lightly for fear of getting burned ;)

Somehow I've just gotten used enough to this that the
'use-before-lexical-definition' ugliness just doesn't bother me.  But it's
probably a sign that I've grown into a long-term relationship with python:
I've learned to gloss over some of its defects as a price for all the good
things it gives me, and at this point I just ignore them without having to
work at it.  I guess I'm officially married to the language :)

Best,

f



More information about the Python-list mailing list