New submission from A.M. Kuchling <[EMAIL PROTECTED]>: bytearray's methods aren't consistent in what they accept.
append() takes either an int or a character: >>> b = bytearray('abc') >>> b.append(76) ; b bytearray(b'abcL') >>> b.append('M') ; b bytearray(b'abcLM') .insert() accepts only integers: >>> b.insert(0, 97) ; b bytearray(b'aabcLM') >>> b.insert(0, 'a') ; b Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: an integer is required Both PEP 358 and the docstring for .append() only document 'int' as a legal input, so I suspect append() is wrong here. ---------- messages: 68487 nosy: akuchling severity: normal status: open title: bytes type has inconsistent methods (append, insert) type: behavior versions: Python 2.6 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3156> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com