[].keys() and [].items() (Was: Why I think range is a wart)
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Wed Mar 13 17:25:48 EST 2002
On Wed, 13 Mar 2002 22:23:02 +0000, Gonçalo Rodrigues
<op73418 at mail.telepac.pt> wrote:
>On Wed, 13 Mar 2002 13:01:13 -0800, James_Althoff at i2.com wrote:
>
>>
>>[ruud de rooij[
>>| perhaps lists should support .keys() and .items() for those operations
>>| (analogous to dictionaries).
>>
>>[Clark C . Evans]
>>| Very nice idea. This is PEP worthy. It is nice beacuse it
>>| does not introduce anything new; a list can easily be viewed
>>| as a mapping having a positive integer domain. This is simple,
>>| consistent, and quite elegant.
>>
>>I would like to see:
>> .keys()
>> .items()
>> .iterkeys()
>> .iteritems()
>>
>>jim
>>
>
>The same idea should be extended to any sequence, actually.
>
>Gonçalo Rodrigues.
In case I am misunderstood, sequence = object supporting a list-like
protocol (__getitem__, etc.), not just an iterable.
More information about the Python-list
mailing list