[Python-ideas] Proposal for default character representation

Jonathan Goble jcgoble3 at gmail.com
Fri Oct 14 02:21:54 EDT 2016


On Fri, Oct 14, 2016 at 1:54 AM, Steven D'Aprano <steve at pearwood.info> wrote:
>> and:
>>
>> o = ord (c)
>> if 100 <= o <= 150:
>
> Which is clearly not the same thing, and better written as:
>
> if "d" <= c <= "\x96":
>     ...

Or, if you really want to use ord(), you can use hex literals:

o = ord(c)
if 0x64 <= o <= 0x96:
    ...


More information about the Python-ideas mailing list