On 27/12/20 10:15 am, Christopher Barker wrote:
> ... the only thing
> you should *need* is an items() method that returns an iterable (pf
> pairs of objects).
It seems to me it would be more fundamental to use iteration to get
the keys and indexing to get the corresponding values. You're only
relying on dunder methods then.
And that seems to work as well, I made a "Mapping" with a do-nothing .items(), but a functional __iter__ and __getitem__
and that seems to work as well.
Though it seems that .items() could be more efficient, if it's there. Maybe not significant, but still ...
In any case, I'd like to see the protocol be duck-typed, like, as far as I know, every other protocol in Python, rather than doing actual type checking.
I'd live to hear why it currently checks for Mapping, rather than simply calling the methods it needs.
Python-ideas mailing list -- email@example.com
To unsubscribe send an email to firstname.lastname@example.org
Message archived at https://email@example.com/message/Z4UL4NZQ7JS3JLVMYOZZVN2N3FL6UKCW/
Code of Conduct: http://python.org/psf/codeofconduct/