Barry, you're taking the metaphor too far. Duct typing is about presenting
a certain interface. If your function takes an object that has a get(key,
default) method, the rest doesn't matter. That's the only way in which the
object needs to resemble a duck in your function.

I'd like to +1 this proposal. It should be trivial to implement. It won't
break backward compatibility. It's intuitive. I can think of several places
I would use it. I can't think of a good reason not to include it.

On Wed, Mar 1, 2017 at 12:06 PM, Barry <ba...@barrys-emacs.org> wrote:

>
> > On 1 Mar 2017, at 01:26, Michel Desmoulin <desmoulinmic...@gmail.com>
> wrote:
> >
> > - you can iterate on both
> Maybe, bit do you want the keys, values or (key, value) items? Keys being
> the deafult.
> > - you can index both
> Maybe as you cannot in the general case know the index. Need keys().
> > - you can size both
> Yes
>
> I think this duck cannot swim or quack.
>
> Barry
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to