Problem with Lexical Scope
jslowery at gmail.com
jslowery at gmail.com
Mon Dec 12 02:50:42 EST 2005
I am not completely knowledgable about the status of lexical scoping in
Python, but it was my understanding that this was added in a long time
ago around python2.1-python2.2
I am using python2.4 and the following code throws a "status variable"
not found in the inner-most function, even when I try to "global" it.
def collect(fields, reducer):
def rule(record):
status = True
def _(x, y):
cstat = reducer(x, y)
if status and not cstat:
status = False
return y
return reduce(_, [record[field] for field in fields])
return rule
What gives?
More information about the Python-list
mailing list