On Tue, Dec 3, 2019, at 01:02, Kyle Stanley wrote:
> However, if the OP wants to personally implement this behavior for 
> their own subclass of sets (instead of adding it to the language), that 
> could be done rather easily:

The OP wanted to return the object that was in the set. I don't think there's 
currently a way to get it in O(1) time [you can get it in O(N) with a naive 
loop or with s - (s - {key})]. intersection returns precisely the wrong object 
in my tests.
_______________________________________________
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/U6ZH675JXMXV5ID3AQ5VCXNNLXWYD76Z/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to