Suggestion: make sequence and map interfaces more similar

Marco Sulla marcosullaroma at gmail.com
Fri Mar 25 20:35:33 EDT 2016


Peter Otten wrote:

>> I noticed that the sequence types does not have these methods that the
map
>> types  has: get(), items(), keys(), values().
>> It could seem useless to have them for sequences, but I think it will
ease
>> the creation of functions and methods that allow you to input a generic
>> iterable as parameter, but needs to use one of these methods in case the
>> parameter is a map.

> It will also break existing uses of duck typing.

Yes, I suppose it's too late to introduce these methods to sequences.

I'd like to see vdict implemented anyway. It can't break old code and add a
map type that has a common interface with sequences.



More information about the Python-list mailing list