[Python-ideas] Consider making enumerate a sequence if its argument is a sequence
Andrew Barnert
abarnert at yahoo.com
Thu Oct 1 04:24:03 CEST 2015
On Sep 30, 2015, at 17:04, Terry Reedy <tjreedy at udel.edu> wrote:
>
>> On 9/30/2015 5:33 PM, Andrew Barnert via Python-ideas wrote:
>>
>> (The fact that we don't have a term for "non-iterator iterable",
>
> 'collection'
That's a perfectly good term, but it's not used that way in the docs, nor is anyone else using it in the discussions so far. Are you suggesting that we should start doing so?
There are definitely parts of the docs that could be clarified or simplified with this term, such as the glossary entry and definitions for dict views, which inaccurately use the term "sequence". (And similarly, although not quite as badly, someone in this thread referred to "sequences and sequence-like things", which may be a little more intuitive than my "non-iterator iterables", but still isn't all that clear.)
Also, the tutorial uses the phrases "data structures" or "data type" a few zillion times, apparently to avoid having to come up with a term that includes sequences, sets, dicts, and strings without being inaccurate. I've seen novices have no idea what "data structure" means, or get confused by what the difference between a "data type" and a "regular type" is.
> Some are concrete: they contain reference to actual Python objects.
> Some are virtual (lazy): they contain the information need to create Python objects as needed.
I think the docs used to use the word "virtual" as a more specific term than "lazy": a view onto an object that conceptually exists but doesn't actually exist is "virtual" (like range, which is a view into the infinite set of integers), but a view into a real object isn't (like dict_keys, which has a reference to an actual dict), nor is something that isn't conceptually view-like at all (like a RNG iterator), even though they're all "lazy". It looks like the word "virtual" in this context doesn't appear anywhere in the docs anymore, so I suppose it could be repurposed, but if it's just a synonym for "lazy", what's wrong with "lazy"?
More information about the Python-ideas
mailing list