[Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...] (original) (raw)
Guido van Rossum guido at python.org
Mon Jul 9 16đ07 EDT 2018
- Previous message (by thread): [Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]
- Next message (by thread): [Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Definitely docs first. And we should keep references to generator expressions too, if only to explain that they've been renamed.
Perhaps someone should try it out in a 3rd party tutorial to see how it goes? I'm CC'ing Raymond Hettinger.
On Mon, Jul 9, 2018 at 12:57 PM Brett Cannon <brett at python.org> wrote:
On Mon, 9 Jul 2018 at 12:05 Guido van Rossum <guido at python.org> wrote: I think this is worth a try.
How far do we want to go with this? Update the docs? Update the grammar and/or code? I think the former is probably good enough for now to see if it takes, and if it does then we can talk about updating code to not confuse people.
On Mon, Jul 9, 2018 at 12:04 PM Chris Barker - NOAA Federal <_ _chris.barker at noaa.gov> wrote: TL;DR- +1 on advocating the term âgenerator comprehensionâ as a synonym for âgenerator expressionâ in future documentation and instructional materials. The long version: If we were starting from scratch, maybe it would makes sense to use â builderâ or something else, rather than comprehension. But weâre not starting from scratch. And âlist comprehensionâ has become a pretty universal (or at least common) term in the python world. So we really canât expect to re-name that. And despite the term having its roots in an esoteric corner of mathematics, Iâve never seen anyone confused by it â itâs just a new word for a new thing to most folks. Which is actually why âgenerator expressionâ is a bit confusing â it seems to have more in common with comprehensions than with generators (As in: the things functions with a yield in them produce) In fact, the term âgeneratorâ is a bit confusing itself â due to it being a common English word, it seems to refer to the generic idea of âa thing that generates values on the flyâ, which, of course it can be in Python. But it actually is a specific type. And you can make a âthing that generates values in the flyâ with a regular class that follows the iterator protocol. So re-using the word in âgenerator expressionâ just adds a bit to the confusion. (Even though itâs technically correct, it does âmakeâ an actual generator object, doesnât it? (On a phone, so I canât check) but thatâs kind of an implementation detail. Also: if you google: âpython list comprehensionâ you get a LOT of hits to tutorials, etc. So it is WAY too late to change that name. When you google âpython generator expressionâ the top hit is the python docs, and the next few are about comparing generator expressions and list comprehensions. So I think we could start a new naming scheme for those. âcause then weâd get lost of questions about the difference between generator expressions and generator comprehensions ;-)
-CHB -- --Guido van Rossum (python.org/~guido)
-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180709/ba69f357/attachment.html>
- Previous message (by thread): [Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]
- Next message (by thread): [Python-Dev] Naming comprehension syntax [was Re: Informal educator feedback on PEP 572 ...]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]