Hi,

I don't like the behaviour of Python 3000 when we compare a bytes strings
with length=1:
   >>> b'xyz'[0] == b'x'
   False

The code can be see as:
   >>> ord(b'x') == b'x'
   False

or also:
   >>> 120 == b'x'
   False


Two solutions:
 1. b'xyz'[0] returns a new bytes object (b'x' instead of 120) 
    like b'xyz'[0:1] does
 2. allow to compare a bytes string of 1 byte with an integer

I prefer (2) since (1) is wrong: bytes contains integers and not bytes!

Victor Stinner aka haypo
http://hachoir.org/
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to