[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-29 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___ ___ Python-bugs-list

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-28 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 536fccc75f5a by Eli Bendersky in branch 'default': Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format. http://hg.python.org/cpython/rev/536fccc75f5a -- nosy: +python-dev

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-28 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Petri, thanks for the patch. I've updated Misc/NEWS and committed it. Unless there are objections or problems, I will close this issue in a day or two. -- resolution: - fixed stage: patch review - committed/rejected

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-27 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: Looks good. How about also adding some tests for the original request of supporting bytearrays in ljust/rjust/center? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-27 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Updated the patch to add tests for {bytes,bytearray}.{center,ljust,rjust}. The tests check that both bytes and bytearray are always accepted as the fill character. -- Added file:

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-26 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: Removed file: http://bugs.python.org/file22756/c_format_bytearray.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-26 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: Removed file: http://bugs.python.org/file22757/c_format_buffer.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-26 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Updated the bytearray patch to change documentation and add tests. -- Added file: http://bugs.python.org/file22764/c_format_bytearray.patch ___ Python tracker rep...@bugs.python.org

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: The solution could be global, to allow bytearray fit the 'c' format of PyArg_ParseTuple. Then one would also be able to pass a bytearray into other stringlib methods requiring the 'c' format. Another possibility would be the change the 'c'

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: Added file: http://bugs.python.org/file22757/c_format_buffer.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- keywords: +needs review stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: c_format_bytearray.patch looks ok to me. The other proposal is too broad, and may lead to confusing behaviour. In any case, some tests are needed. -- ___ Python tracker rep...@bugs.python.org

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-16 Thread Eli Bendersky
Eli Bendersky eli...@gmail.com added the comment: On one hand, I agree that the situation isn't intuitive. Why should some methods of bytearray accept bytearrays, and some shouldn't? On the other hand, this actually has rather deep implementation reasons. Methods like 'translate' are

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-28 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I do agree it is a nuisance that it doesn't work with bytearray instances. After all, these methods are supposed to be homogeneous, and they are when called on a str or bytes object. -- assignee: docs@python - stage: committed/rejected

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-28 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- components: -Documentation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___ ___

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-22 Thread Petri Lehtinen
Changes by Petri Lehtinen pe...@digip.org: -- nosy: +petri.lehtinen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___ ___ Python-bugs-list

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-22 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: After thinking about this awhile, I see the key sentence of David's reply as The data type of the arguments to the method have no necessary relationship with the datatype of the object. While true in general, in it not true with respect to

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-22 Thread Eli Bendersky
Changes by Eli Bendersky eli...@gmail.com: -- nosy: +eli.bendersky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12380 ___ ___ Python-bugs-list

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: What's the use case? I'm inclined to reject this as not needed. -- nosy: +r.david.murray type: behavior - feature request versions: +Python 3.3 -Python 2.7, Python 3.1 ___ Python tracker

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread py.user
py.user port...@yandex.ru added the comment: all other methods support it and it's right barr = bytearray(b'abcd*') barr.center(len(barr) * 4, barr[-1:]) Traceback (most recent call last): File stdin, line 1, in module TypeError: must be a byte string of length 1, not bytearray b =

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: A bytearray is for working with mutable data. We don't support using it in all places that the non-mutable data types can be used. You can code your example like this: barr.center(len(barr) * 4, bytes([barr[-1]])) I realize that

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread py.user
py.user port...@yandex.ru added the comment: A bytearray is for working with mutable data. We don't support using it in all places that the non-mutable data types can be used. bytearray(b'abcd').strip(bytearray(b'da')) bytearray(b'bc') .translate, .find, .partition, ...

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: All right, let's get some other opinions from people who have actually worked with the bytearray and bytes code (and Terry because he cares about APIs). -- nosy: +haypo, ncoghlan, pitrou, rhettinger, terry.reedy status: closed -

[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-20 Thread py.user
Changes by py.user port...@yandex.ru: -- title: bytearray center, ljust, rjust don't accept a bytearray as the fill character - bytearray methods center, ljust, rjust don't accept a bytearray as the fill character ___ Python tracker