[Python-ideas] Consider making enumerate a sequence if its argument is a sequence

Andrew Barnert abarnert at yahoo.com
Wed Sep 30 21:31:39 CEST 2015


On Sep 30, 2015, at 12:19, Andrew Barnert via Python-ideas <python-ideas at python.org> wrote:
> 
> Maybe the problem is that we don't have enough words. I've tried to use "view" to refer to a lazy non-iterator iterable (dict views, range, NumPy slices), which seems to help within the context of a single long explanation for a single user's problem, but I'm not sure that's something we'd want enshrined in the glossary, since it's a general English word that probably has wider usefulness.

I've just remembered that I said the exact same thing last time this discussion came up (less than 4 months ago), and someone pointed out to me that the docs already define the word "view" in the glossary specifically for dict/mapping views, and use the term "lazy sequence" in that definition, and use the term "virtual sequence" elsewhere.

It's worth noting that dict views are not actually sequences, so defining view in terms of lazy sequence is probably not a good idea...

Anyway, we probably don't need to invent any new terms; maybe we just need to pick some wording, define it clearly, and use it consistently throughout the docs.


More information about the Python-ideas mailing list