[Python-checkins] r53860 - peps/trunk/pep-0000.txt peps/trunk/pep-0358.txt

Nick Coghlan ncoghlan at gmail.com
Fri Feb 23 11:48:01 CET 2007

Jim Jewett wrote:
> This does force the use of more regular expressions, by ruling out
> data.upper().startswith("ERROR:")

It merelyforces you to make the encoding explicit (rather than assuming 
ASCII or latin-1) by converting the bytes to a character sequence first:

   str(data, 'latin-1').upper().startswith("ERROR:")

This makes sense, since 'uppercase' and 'lowercase' are attributes of 
characters, not of bytes.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-checkins mailing list