New submission from David Miguel Susano Pinto <carandraug+...@gmail.com>:
set union, intersection, difference methods accept any non-zero number of sets and return a new set instance, like so: >>> a = set([1, 2]) >>> b = set([1, 3]) >>> c = set([3, 5]) >>> set.union(a, b, c) {1, 2, 3, 5} even if it's only one argument: >>> set.union(a) {1, 2} I think it would be nice if zero arguments were not an error: >>> set.union() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: descriptor 'union' of 'set' object needs an argument This would allow to handle any sequence of sets which otherwise requires this: if len(sequence): return set.union(*sequence) else: return set() ---------- messages: 330601 nosy: carandraug priority: normal severity: normal status: open title: set union/intersection/difference could accept zero arguments type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35338> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com