This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients py.user, r.david.murray
Date 2011-06-21.22:51:47
SpamBayes Score 2.7860714e-10
Marked as misclassified No
Message-id <1308696708.46.0.838378103844.issue12380@psf.upfronthosting.co.za>
In-reply-to
Content
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 isn't particularly pretty, but that has more to do with the fact that indexing bytes gives you ints in Python 3 than it does with whether or not bytearray is accepted.

The data type of the arguments to the method have no necessary relationship with the datatype of the object.

You may have more success arguing that the fill character for both bytearray and bytes should be allowed to be an int.

I think this whole topic is better addressed in a forum such as python-ideas.  I agree that the bytes interface is a bit wonky in places, but I think that if changes are going to be made a consensus needs to be developed on what changes to make.  I believe some conversations about this have already taken place, and so far I don't think there are any consensus proposals.

So, I'm going to close this issue.  But please join (or start, if necessary) the discussion on this wider topic in the appropriate forum.
History
Date User Action Args
2011-06-21 22:51:48r.david.murraysetrecipients: + r.david.murray, py.user
2011-06-21 22:51:48r.david.murraysetmessageid: <1308696708.46.0.838378103844.issue12380@psf.upfronthosting.co.za>
2011-06-21 22:51:47r.david.murraylinkissue12380 messages
2011-06-21 22:51:47r.david.murraycreate