On 8/12/07, Paul Moore <[EMAIL PROTECTED]> wrote: > 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?).
I doubt it, but if it was it should be translated to unicode upon loading and have no effect on the semantics. > 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... I don't think this behaviour change is a problem. It's just a bit surprising and something that has to be learned when you switch to 3.0. It matches list behaviour and in the end will reduce the concepts needed to use the language. > 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. -- Adam Olsen, aka Rhamphoryncus _______________________________________________ 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