Chris Angelico schreef op 17/07/2018 0:48:
On Tue, Jul 17, 2018 at 8:41 AM, Roel Schroeven <r...@roelschroeven.net> wrote:
In any case, even though Python 3's byte strings are not quite unlike Python
2's strings, they're not exactly like them either. And I feel there are
cases where that makes things somewhat harder, even though I can't prove it.

You're absolutely right, and some of those differences were repaired
in different 3.x versions (for instance, the ability to use
percent-formatting with byte strings was reinstated in 3.5).

Indeed, and that was very helpful.

Some of the differences are fundamental, but anything else should be considered fair game for an enhancement request. So next time you go "ugh, Python 3's byte strings are such a pain because XYZ", post here
 or on python-ideas about a possible fix.

I'll remember that.

That said, though, the fact that indexing a byte string yields an int
instead of a one-byte string is basically unable to be changed now,
and IMO it'd be better to be consistent with text strings than with
bytearray. I'm not sure how many of the core devs agree that
b'spam'[1] ought to be b'p' rather than 112, but I'd say they all
agree that it's too late to change it.

I had expected b'spam'[1] would be b'p', and it took me some to figure out it was 112 and that that was why my code wasn't working anymore when I converted it from Python 2 to Python 3. But that doesn't necessarily mean b'p' would have been better than 112. A case can be made for both. I'm aware of it now, and it's not a big deal anymore. And indeed, too late to change.

--
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
        -- Franklin P. Jones

Roel Schroeven

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to