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.

Author akira
Recipients akira, josh.r, rhettinger, roy.wellington
Date 2014-07-29.21:06:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406667987.46.0.890865504326.issue22089@psf.upfronthosting.co.za>
In-reply-to
Content
On the other hand update() method may accept multiple iterables at once:

  def update(self, *iterables):
      for it in iterables:
          self |= it

and therefore it is not equivalent to __ior__ method. In this case:
'difference', 'intersection', 'union' set methods could also be added to
Set and 'difference_update', 'intersection_update', 'update' to
MutableSet.

Negative consequences:

- no use-case?

- there are more than one way to spell an operation e.g., &= and
  intersection_update for a single iterable case

- documentation, tests, methods implementation have to be maintained in
  sync with frozenset/set

Positive:

- Set/MutableSet can be a drop in replacement for frozenset/set without
  manually reimplementing the named methods even if multiple iterables
  are not used

- documentation, tests, methods implementation are maintained only in
  stdlib and therefore bugs are fixed in a single place and the same
  behavior everywhere

I've uploaded a prototype patch that implements the named methods,
mentions them in Set/MutableSet documentation, and adds sanity tests.

If somebody provides a compelling use-case for adding the named methods
then further work on the patch could be done.
History
Date User Action Args
2014-07-29 21:06:27akirasetrecipients: + akira, rhettinger, josh.r, roy.wellington
2014-07-29 21:06:27akirasetmessageid: <1406667987.46.0.890865504326.issue22089@psf.upfronthosting.co.za>
2014-07-29 21:06:27akiralinkissue22089 messages
2014-07-29 21:06:27akiracreate