On 2019-04-23 01:54, Eli the Bearded wrote:
Here's some code I wrote today:

[snip]

# decode a single hex digit
def hord(c):
     c = ord(c)
     if c >= ord(b'a'):
         return c - ord(b'a') + 10
     elif c >= ord(b'A'):

There's a bug here:

         return c - ord(b'a') + 10

It should be:

         return c - ord(b'A') + 10

     else:
         return c - ord(b'0')

However, the entire function can be replaced with int(c, 16), anyway. :-)

[snip]
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to