[New-bugs-announce] [issue4069] set.remove raises confusing KeyError
Carl Friedrich Bolz
report at bugs.python.org
Tue Oct 7 17:58:34 CEST 2008
New submission from Carl Friedrich Bolz <cfbolz at gmx.de>:
When trying to remove a set from a set, the KeyError that is raised is
confusing:
Python 2.6 (r26:66714, Oct 7 2008, 13:23:57)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = set([frozenset([1, 2]), frozenset([2, 3])])
>>> s.remove(set([3, 4]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: frozenset([])
I understand that s.remove(set(...)) turns the set into a frozenset, but
I was expecting this converted frozenset to be attached to the KeyError,
not an empty set.
----------
components: Interpreter Core
messages: 74461
nosy: cfbolz
severity: normal
status: open
title: set.remove raises confusing KeyError
type: behavior
versions: Python 2.5, Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4069>
_______________________________________
More information about the New-bugs-announce
mailing list