Problem with Lexical Scope
- From: "jslowery@xxxxxxxxx" <jslowery@xxxxxxxxx>
- Date: 11 Dec 2005 23:50:42 -0800
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?
.
- Follow-Ups:
- Re: Problem with Lexical Scope
- From: Duncan Booth
- Re: Problem with Lexical Scope
- From: Steve Holden
- Re: Problem with Lexical Scope
- From: jslowery@xxxxxxxxx
- Re: Problem with Lexical Scope
- Prev by Date: Re: newbie question
- Next by Date: Re: Using XML w/ Python...
- Previous by thread: Re: nanothreads: Want to use them from within wxPython app
- Next by thread: Re: Problem with Lexical Scope
- Index(es):
Relevant Pages
|