Terry J. Reedy added the comment:

Whatever the change, bytes and bytearray should act the same.

>>> b = bytes(range(8))
>>> b
b'\x00\x01\x02\x03\x04\x05\x06\x07'
>>> b.partition(3)
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    b.partition(3)
TypeError: expected bytes, bytearray or buffer compatible object

As noted in the thread, ba.partition(a) apparently is executed as 
ba.partition(bytearray(a)) if a is not a bytearray (or maybe not a buffer 
object). bytearray(3) == bytearray((0,0,0)) and the latter is not in ba and 
hence the output given is 'correct'.

----------
nosy: +terry.reedy

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

Reply via email to