New submission from Brecht Machiels:

set's add() method would be a little bit more useful if it would return True if 
the added value was already present in the set, and False if it wasn't (or the 
other way around). Similarly, discard() could report whether the discarded 
value was present in the set or not.

I suppose this could cost a couple of extra cycles and I'm not sure this is 
acceptable. For discard() there's always remove() that offers similar behavior. 
add() does not have an alternative that offers check-and-add behavior.

----------
components: Library (Lib)
messages: 231226
nosy: brechtm
priority: normal
severity: normal
status: open
title: Make set's add and discard methods return useful information
type: enhancement
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22879>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to