[issue35338] set union/intersection/difference could accept zero arguments

2018-12-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: Given the "feature" in question isn't actually an intended feature (just an accident of how unbound methods work), I'm closing this. We're not going to try to make methods callable without self. -- resolution: -> wont fix stage: -> resolved status:

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-30 Thread Mark Dickinson
Mark Dickinson added the comment: > set.union() without constructing the set you call union on only happens to > work for the set.union(a) case because `a` is already a set. Good point. I wasn't thinking clearly about the unbound-methodness of this. > I'm -1 on making any changes to set.unio

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: set.union() without constructing the set you call union on only happens to work for the set.union(a) case because `a` is already a set. union takes arbitrary iterables, not just sets, and you're just cheating by explicitly passing `a` as the expected self ar

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: > The intersection of an empty set of sets is either the empty set [...] Nope, it's never the empty set, unless you're using a *very* unusual definition. The intersection of a collection X of sets is the set of all x in the universe such that x is in S for a

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: Some reading: http://mathforum.org/library/drmath/view/62503.html -- ___ Python tracker ___ ___ P

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-29 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: The intersection of an empty set of sets is either the empty set or the universe sets so if set.union() is defined to support set.union(*sequence), wouldn't it be less surprising for set.intersection() to return the empty set too? -- nosy: +remi.lapeyr

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-29 Thread Mark Dickinson
Mark Dickinson added the comment: What would the intersection of zero sets be? The only reasonable mathematical answer is either "not defined", or "the universe" - i.e., the set containing everything, but what would "everything" be in a Python context? I also don't see how a difference of ze

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-28 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-28 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I agree with @SilentGhost to use set().union(*sequence) which is compatible with Python 2 too. -- nosy: +rhettinger, xtreak ___ Python tracker ___

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-28 Thread SilentGhost
SilentGhost added the comment: You can write your code like this: set().union(*sequence) as well as: a.union(b, c) if you already have a set object available. -- nosy: +SilentGhost versions: +Python 3.8 -Python 3.7 ___ Python tracker

[issue35338] set union/intersection/difference could accept zero arguments

2018-11-28 Thread David Miguel Susano Pinto
New submission from David Miguel Susano Pinto : 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