Status of PEP's?

James_Althoff at i2.com James_Althoff at i2.com
Tue Mar 5 20:33:44 EST 2002


[James_Althoff]
>
> I don't have to think that a dict object *is* a sequence to be
> content with it being a valid arg to iter().

[Greg Ewing]
> Well, more generally, "collection".

Good.  That's step one: generalizing from sequence to collection <wink>.

[Greg Ewing]
> And I *do* think
> of a dict as being a collection -- of key-value pairs.
> It's perhaps debatable whether its iterator should
> return just the keys or keys+values, but the decision
> made here makes perfectly good sense to me. In real
> life, it doesn't seem at all odd to ask things like
> "Is 'furgleblunger' in the dictionary?"
>
> But if someone asked me "Is 7 in 42?" I'd think
> I'd misheard them somehow.

I agree that the choice of the particular keyword "in" as in "for x in y"
lends itself to being interpreted as "for each object that is a member of y
which *is* an aggregation of other objects".  But, since Python has already
generalized beyond that, I think it's fine to say that "in" means something
more than that restricted interpretation (e.g., "for each object generated
by the iter(y) object").  Your basic difference of opinion, I suppose.

you-say-furgleblunger-i-say-spline-ly yr's,

Jim





More information about the Python-list mailing list