Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105735

Re: Suggestion: make sequence and map interfaces more similar

From Marco Sulla <marcosullaroma@gmail.com>
Newsgroups comp.lang.python
Subject Re: Suggestion: make sequence and map interfaces more similar
Date 2016-03-26 01:35 +0100
Message-ID <mailman.25.1458986375.28225.python-list@python.org> (permalink)
References <mailman.34.1458721359.2244.python-list@python.org> <56f27d76$0$1600$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Suggestion: make sequence and map interfaces more similar "Marco S." <mail.python.org@marco.sulla.e4ward.com> - 2016-03-22 20:54 +0100
  Re: Suggestion: make sequence and map interfaces more similar Steven D'Aprano <steve@pearwood.info> - 2016-03-23 22:26 +1100
    Re: Suggestion: make sequence and map interfaces more similar Marco Sulla <marcosullaroma@gmail.com> - 2016-03-26 01:18 +0100
      Re: Suggestion: make sequence and map interfaces more similar Steven D'Aprano <steve@pearwood.info> - 2016-03-26 22:41 +1100
    Re: Suggestion: make sequence and map interfaces more similar Marco Sulla <marcosullaroma@gmail.com> - 2016-03-26 01:35 +0100
    Re: Suggestion: make sequence and map interfaces more similar Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-26 10:29 +0000

csiph-web