03.12.19 02:25, Soni L. пише:
This is an odd request but it'd be nice if, given a set s = {"foo"}, s["foo"] returned the "foo" object that is actually in the set, or KeyError if the object is not present.

Even use-cases where you have different objects whose differences are ignored for __eq__ and __hash__ and you want to grab the one from the set ignoring their differences would benefit from this.

It was discussed before. The conclusion was that there are too small use cases for this (although with adding := and discussing the addition of + for dicts this is no longer considered a strong argument) and in these cases a dict works as well as a set.
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
Message archived at 
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to