Jörn Hees added the comment:

> I'm closing this because the OP's original concern about wanting an in-place 
> operation was already solved

Was it? Are you referring to http://bugs.python.org/issue13121 ?

My main concern was that += is considerably slower than .update(), kind of 
catching me off-guard. As you closed this, i'd be very happy if you could maybe 
add a note to the docs 
https://docs.python.org/3/_sources/library/collections.txt that points this 
behavior out. Maybe by changing this:

    * The multiset methods are designed only for use cases with positive values.
      The inputs may be negative or zero, but only outputs with positive values
      are created.  There are no type restrictions, but the value type needs to
      support addition, subtraction, and comparison.

    * The :meth:`elements` method requires integer counts.  It ignores zero and
      negative counts.


to this:

    * The multiset methods (``+``, ``-`` and ``+=``, ``-=``) are designed only
      for use cases with positive values.
      The inputs may be negative or zero, but only outputs with positive values
      are created.  There are no type restrictions, but the value type needs to
      support addition, subtraction, and comparison.

    * Because of the necessary additional checks for positive values, a ``c += 
d``
      can be considerably slower than a ``c.update(d)``.

    * The :meth:`elements` method requires integer counts.  It ignores zero and
      negative counts.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23509>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to