[issue24892] bytes.join() won't take it's own type as the argument
Timothy Geiser
report at bugs.python.org
Wed Aug 19 03:33:10 CEST 2015
Timothy Geiser added the comment:
I believe the special case has already been made: iterating over bytes-like objects returns ints. Natually, join() should take the same thing. Also, constructor bytearray(iterable_of_ints), the mutable-sequence expression ba[i:j:k] = t, and the function ba.extend(t) with t as an iterable of ints. It's the s.join(t) that's different than all these others.
Again:
>>> ba = bytearray(b'barbaz')
>>> ba[0:4:2] = b'ft'
>>> ba
bytearray(b'fatbaz')
>>> ba.extend(b'foo')
>>> ba
bytearray(b'fatbazfoo')
>>> ba.join(b'not_this_though')
Traceback (most recent call last):
File "<pyshell#32>", line 1, in <module>
ba.join(b'not_this_though')
TypeError: sequence item 0: expected a bytes-like object, int found
I'll go ahead argue that it's exactly backwards as is.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24892>
_______________________________________
More information about the Python-bugs-list
mailing list