Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set.union accepts not set iterables for all but the first argument. #59290

Closed
krastanov-stefan mannequin opened this issue Jun 16, 2012 · 2 comments
Closed

set.union accepts not set iterables for all but the first argument. #59290

krastanov-stefan mannequin opened this issue Jun 16, 2012 · 2 comments

Comments

@krastanov-stefan
Copy link
Mannequin

krastanov-stefan mannequin commented Jun 16, 2012

BPO 15085
Nosy @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-06-16.14:02:45.958>
created_at = <Date 2012-06-16.09:09:08.532>
labels = ['invalid']
title = 'set.union accepts not set iterables for all but the first argument.'
updated_at = <Date 2012-06-16.14:02:45.956>
user = 'https://bugs.python.org/krastanov-stefan'

bugs.python.org fields:

activity = <Date 2012-06-16.14:02:45.956>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2012-06-16.14:02:45.958>
closer = 'r.david.murray'
components = ['None']
creation = <Date 2012-06-16.09:09:08.532>
creator = 'krastanov-stefan'
dependencies = []
files = []
hgrepos = []
issue_num = 15085
keywords = []
message_count = 2.0
messages = ['162962', '162973']
nosy_count = 2.0
nosy_names = ['r.david.murray', 'krastanov-stefan']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue15085'
versions = ['Python 2.7']

@krastanov-stefan
Copy link
Mannequin Author

krastanov-stefan mannequin commented Jun 16, 2012

>>> 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?

@bitdancer
Copy link
Member

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant