Message239642
The behavior for multiplying or adding doesn't seem quite so intuitive when you allow for a bounded deque. In particular, it doesn't seem obvious that multiplying when the deque is bounded, you'll get results like:
>>> list(deque([1,2], 3) * 2)
[2, 1, 2]
Similarly, when you support non-in-place addition, the bounded-ness of the result depends on the order of the values added.
>>> list(deque([1,2], 3) + deque([1,2], 2))
[1, 2, 1]
>>> list(deque([1,2], 2) + deque([1,2], 3))
[1, 2]
Not saying these are the wrong behaviors, but it's much more weird than what you get with other sequence types (since most sequence types aren't bounded), and possibly why deques didn't include these features in the first place; trying to act like a generalized sequence when you have features that don't fit the model is a titch odd. |
|
Date |
User |
Action |
Args |
2015-03-30 21:18:24 | josh.r | set | recipients:
+ josh.r, rhettinger |
2015-03-30 21:18:24 | josh.r | set | messageid: <1427750304.67.0.761248726763.issue23793@psf.upfronthosting.co.za> |
2015-03-30 21:18:24 | josh.r | link | issue23793 messages |
2015-03-30 21:18:24 | josh.r | create | |
|