[Python-Dev] pending deprecation warning for Set.update

Neil Schemenauer nas-python at python.ca
Wed Sep 17 12:44:35 EDT 2003


On Wed, Sep 17, 2003 at 12:02:00PM -0400, Raymond Hettinger wrote:
> The verbosity issue weighs less because there is the __ior__ operator
> alternative:   a |= b.   That is succinct as you can get.

>>> from sets import Set
>>> s = Set()
>>> s |= [1, 2, 3]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/www/plat/python2.3/lib/python2.3/sets.py", line 420, in __ior__
    self._binary_sanity_check(other)
  File "/www/plat/python2.3/lib/python2.3/sets.py", line 313, in _binary_sanity_check
    raise TypeError, "Binary operation only permitted between sets"
TypeError: Binary operation only permitted between sets
>>> s.update([1, 2, 3])
>>> s
Set([1, 2, 3])
>>> 

I quite a few instances of update() that will have to be changed to
union_update().

  Neil



More information about the Python-Dev mailing list