Message243904
> 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. |
|
Date |
User |
Action |
Args |
2015-05-23 09:46:17 | joern | set | recipients:
+ joern, rhettinger, serhiy.storchaka |
2015-05-23 09:46:17 | joern | set | messageid: <1432374377.36.0.269010737779.issue23509@psf.upfronthosting.co.za> |
2015-05-23 09:46:17 | joern | link | issue23509 messages |
2015-05-23 09:46:16 | joern | create | |
|