[Python-Dev] Possible resolution of generator
expressionvariablecapture dilemma
Raymond Hettinger
python at rcn.com
Thu Mar 25 02:34:10 EST 2004
> People never leave well enough alone, though, so I hope
> generator expressions don't become another "minor convenience" that's
> viewed
> as a "minor annoyance" a year later.
I do not view genexps as "convenient" short-forms for real generators.
Instead, they represent memory/resource friendly versions of list comps
which have been fabulously successful and have helped move us away from
map/lambda forms. I believe they will make the language more fluid,
cohesive, and expressive.
Once genexps are in, I think everyone will be pleasantly surprised at
how readily the new gizmos work together and how easily they mesh with
what was there before. Behind the scenes genexps will offer the added
benefit of scalability, handling growing volumes of data without
clobbering memory. So please, let's don't get any wild ideas about
throwing the baby out with the bathwater.
In deciding on semantics, we would all rather trade away some power in
exchange for greater clarity about what the expression will do without
having to run it. Put another way, human interpretability is more
important than supporting weird usages. With that criteria,
early-binding is looking to be least nuanced approach.
wishing-i-was-in-DC-ly yours,
Raymond
#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################
More information about the Python-Dev
mailing list