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 values.
The point is that it **should not** be implemented by list and set.
dict([(1, 2)]) should return {1: 2}, not {0: (1, 2)}.
dict({(1, 2)}) should return {1: 2}, not {(1, 2): (1, 2)}.
If you want to propose a new special method common for dict, list and
set, please open a separate thread for this.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/K6AD73WSPAB3HAYBCLZNAYXBRJE54KZB/
Code of Conduct: http://python.org/psf/codeofconduct/