On 11/08/07, Adam Olsen <[EMAIL PROTECTED]> wrote:
> Try h[0:1] == b'P'.  Slicing will ensure it stays as a bytes object,
> rather than just giving the integer it contains.

Ugh. Alternatively, h[0] == ord('P') should work.

Unless you're writing source in EBCDIC (is that allowed?).

All of the alternatives seem somewhat ugly. While I agree with the
idea that the bytes should be kept clean & simple, we seem to be
finding a few non-optimal corner cases. It would be a shame if the
bytes type turned into a Python 3.0 wart from day 1...

Would it be worth keeping a wiki page of the bytes type "idioms" that
are needed, as people discover them? Putting them all in one place
might give a better feel as to whether there is a real problem to
address.

Paul.
_______________________________________________
Python-3000 mailing list
[email protected]
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