Author carandraug
Recipients carandraug
Date 2018-11-28.14:50:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1543416655.98.0.788709270274.issue35338@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2018-11-28 14:50:56carandraugsetrecipients: + carandraug
2018-11-28 14:50:55carandraugsetmessageid: <1543416655.98.0.788709270274.issue35338@psf.upfronthosting.co.za>
2018-11-28 14:50:55carandrauglinkissue35338 messages
2018-11-28 14:50:55carandraugcreate