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 <[email protected]>
<http://bugs.python.org/issue24892>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com