[issue15945] memoryview + bytes fails

2015-03-24 Thread Jean-Paul Calderone
Changes by Jean-Paul Calderone : -- nosy: -exarkun ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue15945] memoryview + bytes fails

2015-03-23 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue15945] memoryview + bytes fails

2014-10-14 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.o

[issue15945] memoryview + bytes fails

2012-10-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, the fact that memoryview + bytes wouldn't return you a memoryview object might be a good reason to disallow it. Compare with: >>> bytearray(b"x") + b"y" bytearray(b'xy') >>> b"x" + bytearray(b"y") b'xy' -- ___

[issue15945] memoryview + bytes fails

2012-10-11 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: Yes, it would be *possible* to fix it with that alone, but that still makes it a pointless 'gotcha' in differing behavior between memoryview and buffer, especially given that bytes+memoryview does something semantically different than memoryview+bytes for no

[issue15945] memoryview + bytes fails

2012-10-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The case where copies are avoided is documented here ... which would be handled nicely by issue15958. -- ___ Python tracker ___ _

[issue15945] memoryview + bytes fails

2012-10-11 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: Le Oct 11, 2012 à 12:13 PM, Antoine Pitrou a écrit : > > Antoine Pitrou added the comment: > > I'm not sure what you're talking about since: > b = buffer("abc") b + "xyz" > 'abcxyz' (b + "xyz") is b > False > > ... doesn't look like it avoid

[issue15945] memoryview + bytes fails

2012-10-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure what you're talking about since: >>> b = buffer("abc") >>> b + "xyz" 'abcxyz' >>> (b + "xyz") is b False ... doesn't look like it avoid copies to me. -- ___ Python tracker

[issue15945] memoryview + bytes fails

2012-10-11 Thread Glyph Lefkowitz
Glyph Lefkowitz added the comment: It's worth noting that the "buffer()" built-in in Python2 had this behavior, and it enabled a copy-reduction optimization within Twisted's outgoing transport buffer. There are of course other ways to do this, but it seems like it would be nice to restore thi

[issue15945] memoryview + bytes fails

2012-09-17 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue15945] memoryview + bytes fails

2012-09-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: Opened issue15958 for the bytes.join enhancement. -- ___ Python tracker ___ ___ Python-bugs-list mai

[issue15945] memoryview + bytes fails

2012-09-16 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Or I could explicitly convert the memoryview to a bytes object. That > strikes me as rather preferable. However, this defeats one use of > memoryview, which is to avoid unnecessary copying. So it might be > suitable workaround for some cases, but not all. I

[issue15945] memoryview + bytes fails

2012-09-16 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: > What is the expected outcome? memoryviews can't be resized, so this scenario isn't possible: The same as `view.tobytes() + bytes`, but without the extra copy implied by `view.tobytes()`. > Just prepend the empty bytestring if you want to make sure the r

[issue15945] memoryview + bytes fails

2012-09-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Just prepend the empty bytestring if you want to make sure the result is a bytes object: >>> b'' + memoryview(b'foo') + b'bar' b'foobar' I think the following limitation may be more annoying, though: >>> b''.join([memoryview(b'foo'), b'bar']) Traceback (most

[issue15945] memoryview + bytes fails

2012-09-15 Thread Stefan Krah
Stefan Krah added the comment: What is the expected outcome? memoryviews can't be resized, so this scenario isn't possible: >>> bytearray([1,2,3]) + b'123' bytearray(b'\x01\x02\x03123') -- nosy: +skrah ___ Python tracker

[issue15945] memoryview + bytes fails

2012-09-15 Thread Jean-Paul Calderone
New submission from Jean-Paul Calderone: Python 3.3.0rc2+ (default:9def2209a839, Sep 10 2012, 08:44:51) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> memoryview(b'foo') + b'bar' Traceback (most recent call last): File "", line 1, in TypeError: