Serhiy Storchaka wrote:
> 1. What special method should be added, `__keys__` or `__items__`? The
> former returns keys, it needs to call `__getitem__` repeatedly to get
> values. The latter returns key-value pairs, it does not need to call
> `__getitem__`, but you should always pay the cost of cre
On Tue, Feb 18, 2020 at 11:47:16AM -0800, Ethan Furman wrote:
> Whatever `dict.items()` returns, both for consistency and because
> `dict.items()` can become a simple alias for `dict.__items__`.
That means that every object wanting to make use of this protocol needs
to create a complex set-like
+1 on the proposed addition. I think that `__items__` would be a better
choice for the method name.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lis
On 02/18/2020 12:24 AM, Serhiy Storchaka wrote:
1. What special method should be added, `__keys__` or `__items__`? The former
returns keys, it needs to call `__getitem__` repeatedly to get values. The
latter returns key-value pairs, it does not need to call `__getitem__`, but you
should alway
18.02.20 19:00, Soni L. пише:
I like __items__. additionally, lists should implement it to return
enumerate(self), and sets should implement it to return (v, v for v in
self), and as such there should be no requirement with regards to
__items__ and __iter__, and whether __iter__ returns keys or
On 2020-02-18 5:34 a.m., Chris Angelico wrote:
On Tue, Feb 18, 2020 at 7:25 PM Serhiy Storchaka wrote:
> * The keys() method is not called in the dict constructor. Just the
> existence of the keys attribute is checked, its value is not used.
Given that that's already been the case, my prefer
+1
On Tue, Feb 18, 2020 at 5:01 AM Andrew Svetlov
wrote:
> Sounds reasonable to me
>
> On Tue, Feb 18, 2020 at 12:32 PM Serhiy Storchaka
> wrote:
> >
> > 18.02.20 10:34, Chris Angelico пише:
> > > Given that that's already been the case, my preferred colour for the
> > > bike shed is...
> >
> >
Sounds reasonable to me
On Tue, Feb 18, 2020 at 12:32 PM Serhiy Storchaka wrote:
>
> 18.02.20 10:34, Chris Angelico пише:
> > Given that that's already been the case, my preferred colour for the
> > bike shed is...
>
> Thank you for your feedback. This is my preferable color too, for both
> parts
18.02.20 10:34, Chris Angelico пише:
Given that that's already been the case, my preferred colour for the
bike shed is...
Thank you for your feedback. This is my preferable color too, for both
parts.
___
Python-ideas mailing list -- python-ideas@pyt
On Tue, Feb 18, 2020 at 7:25 PM Serhiy Storchaka wrote:
> * The keys() method is not called in the dict constructor. Just the
> existence of the keys attribute is checked, its value is not used.
Given that that's already been the case, my preferred colour for the
bike shed is...
> 1. What specia
10 matches
Mail list logo