[issue3156] bytes type has inconsistent methods (append, insert)
Georg Brandl [EMAIL PROTECTED] added the comment: Fixed in 2.6 r65041, and 3k r65043. -- nosy: +georg.brandl resolution: - fixed status: open - closed ___ 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
[issue3156] bytes type has inconsistent methods (append, insert)
Bruno Gola [EMAIL PROTECTED] added the comment: The following patch fixes the behavior, .append and .insert will accept only integer as parameters. Is this really the desired behavior? I mean, why not to accept a character for both methods? There are two tests in Lib/test/test_io.py that uses the old behavior for .append(). -- keywords: +patch nosy: +brunogola Added file: http://bugs.python.org/file10691/issue3156.patch ___ 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
[issue3156] bytes type has inconsistent methods (append, insert)
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