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

Andrew Barnert abarnert at yahoo.com
Thu Oct 1 08:39:04 CEST 2015


On Sep 30, 2015, at 21:05, Emile van Sebille <emile at fenx.com> wrote:
> 
>> On 9/30/2015 7:24 PM, Andrew Barnert via Python-ideas wrote:
>> 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.
> 
> container?

But that means something with a __contains__ test. Containers don't even have to be iterables. It's true that all of the types discussed in the tutorial are containers, but is that actually the meaning we're looking for, or just something that's coincidentally true?

At any rate, even if that does work for the tutorial, I don't think it solves the more general problem. When I want to talk about iterables that give you a different, independent iterator each time you call __iter__, "container" is not the right word for that. Terry's "collection" seems like a better choice, because it doesn't already have a conflicting meaning.


More information about the Python-ideas mailing list