On 7/6/2018 11:20 AM, Brett Cannon wrote:
On Fri, 6 Jul 2018 at 08:52 Chris Barker - NOAA Federal via Python-Dev
<python-dev@python.org <mailto:python-dev@python.org>> wrote:
Are we just having fun here?
Or might we actually start using a new naming convention for
the-syntax-formerly-known-as-generator-expressions?
If you can create a groundswell of support then maybe.
"Comprehension" was an incomprehensible term to me, when I first heard
it. After reading the documentation, I comprehended it, but the term is
meaningless.
"generator expression" is actually a little more comprehensible, by
analogy to a power (electricity) generator... values are generated. But
comprehensions would have been more intuitively understood by me, had
they been called "list generators" or "dict generators" or "set generators".
The difference between comprehensions and generators seems to be one of
timing and sequencing: the comprehensions are comprehended as fast as
possible, while generators are lazy (unlike those electricity
generators, unless you turn them on and off repeatedly). So neither term
is very intuitive to "plain old programmers" unless perhaps they happen
to know some of the advanced math concepts where the term
"comprehension" is claimed to come from (obviously, in spite of a math
degree from some years back, I never encountered that term).
Focusing just on lists, at this time, "list builder" would be better
than "list generator" because using "generator" to replace
"comprehension" would be confusing because of the history of the
terminology as used/documented currently.
A generator seems to be a "lazy list builder".
If the names are changed, for a time both terminologies would have to
coexist, so it would be critical to use terms not already in use in
Python terminology. I would find it an improvement to use terms like
"list builder" rather than "comprehension".
-Brett
-CHB
Sent from my iPhone
> On Jul 3, 2018, at 11:54 PM, Greg Ewing
<greg.ew...@canterbury.ac.nz <mailto:greg.ew...@canterbury.ac.nz>>
wrote:
>
> Steven D'Aprano wrote:
>> - list builder syntax is syntax which returns a list;
>> - dict builder syntax is syntax which returns a dict;
>> - set builder syntax is syntax which returns a set;
>> - generator builder syntax is syntax which returns a generator.
>
> You only get a list/dict/set from the first three after
> you've run the iterators within it, but with a generator
> expression, you already have a generator before you've
> run it. That makes it feel different to me.
>
> --
> Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com