[Python-3000] Immutable bytes -- looking for volunteer (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 27 04:35:10 CEST 2007
- Previous message: [Python-3000] Immutable bytes -- looking for volunteer
- Next message: [Python-3000] Immutable bytes -- looking for volunteer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
However there's quite a bit of Python 2.x code around that manipulates bytes in the guise of 8-bit strings, and it uses tests like "if s[0] == 'x': ..." frequently. This can of course be rewritten using a slice, but not so easily when you're looping over bytes:
for b in bb: if b == b'x': ...
Would it make anything easier if there were a character literal?
for b in bb: if b == c'x': ...
where c'x' is another way of writing ord(b'x').
An advantage of this is that it would make Py3k compatible with Pyrex, which already has c'x' literals. :-)
-- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-3000] Immutable bytes -- looking for volunteer
- Next message: [Python-3000] Immutable bytes -- looking for volunteer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]