[issue17626] set's __isub__ doesn't support non-sets.

2013-04-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: I actually like that list.__iadd__ accepts any iterable, it's a rather nice piece of duck-typing. -- nosy: +pitrou ___ Python tracker ___ _

[issue17626] set's __isub__ doesn't support non-sets.

2013-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Confirmed. This is by design. Guido has long lamented that the += operator for lists would accept any iterable. This led to a number of surprises: s= ['hello']; s += 'world' # Oops! -- ___ Python tracker

[issue17626] set's __isub__ doesn't support non-sets.

2013-04-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: Intentional and documented. "5.7. Set Types — set, frozenset ... Note, the non-operator versions of union(), intersection(), difference(), and symmetric_difference(), issubset(), and issuperset() methods will accept any iterable as an argument. In contrast, th

[issue17626] set's __isub__ doesn't support non-sets.

2013-04-03 Thread Georg Brandl
Georg Brandl added the comment: Assigning to Raymond for confirmation, but IIRC this is by design. -- assignee: -> rhettinger nosy: +georg.brandl, rhettinger status: open -> pending ___ Python tracker

[issue17626] set's __isub__ doesn't support non-sets.

2013-04-03 Thread Roy Wellington
New submission from Roy Wellington: The following: s = set(range(10)) s -= (1, 2, 3) raises a TypeError. Yet the following, which is more verbose and equivalent, succeeds: s.difference_update((1, 2, 3)) Under the hood, __isub__ calls difference_update to do its work. Unfortunately, __isub_