Problem with Lexical Scope
jslowery at gmail.com
jslowery at gmail.com
Mon Dec 12 03:03:43 EST 2005
More information about the Python-list mailing list
Mon Dec 12 03:03:43 EST 2005
- Previous message (by thread): Problem with Lexical Scope
- Next message (by thread): Problem with Lexical Scope
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Well, I think I found a nasty little hack to get around it, but I still
don't see why it doesn't work in the regular way.
def collect(fields, reducer):
def rule(record):
# Nasty hack b/c can't get lexical scoping of status to work
status = [True]
def _(x, y, s=status):
cstat = reducer(x, y)
if s[0] and not cstat:
s[0] = False
return y
reduce(_, [record[field] for field in fields])
return status[0]
return rule
- Previous message (by thread): Problem with Lexical Scope
- Next message (by thread): Problem with Lexical Scope
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list