This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: set.union accepts not set iterables for all but the first argument.
Type: Stage: resolved
Components: None Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: krastanov-stefan, r.david.murray
Priority: normal Keywords:

Created on 2012-06-16 09:09 by krastanov-stefan, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg162962 - (view) Author: Stefan Krastanov (krastanov-stefan) Date: 2012-06-16 09:09
>>> set.union(set([1,2]), [3])
set([1, 2, 3])

>>> set.union([1,2], [3])
TypeError: descriptor 'union' requires a 'set' object but received a 'list'


It seems a bit inconsistent. Is it justified somehow?
msg162973 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-06-16 14:02
By calling 'set.union' you are calling the method on the class.  When you call a method directly on a class object, you have to explicitly pass in 'self'.  Thus the first argument when you call it like that must be a set object.
History
Date User Action Args
2022-04-11 14:57:31adminsetgithub: 59290
2012-06-16 14:02:45r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg162973

resolution: not a bug
stage: resolved
2012-06-16 09:09:08krastanov-stefancreate