On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Comparisons > -----------
> The bytes and buffer types are comparable with each other and > orderable, so that e.g. b'abc' == buffer(b'abc') < b'abd'. I think bytes (regardless of length) should compare to integers, so that: b"" < -sys.maxint < 97 == b'a' < b'aa' < 98 (zero-length buffer < any integer; otherwise compare the number to the first byte, and in case of ties, a BytesSequence of length 2 or more is greater) I'm not as sure about comparing to floats. Should they be incomparable to integer sequences? (97, 98) != b'ab' not (97, 98) < b'ab' not (97, 98) > b'ab' > Bytes and the Str Type > ---------------------- > ... any attempt to mix bytes (or > buffer) objects and str objects without specifying an encoding will > raise a TypeError exception. This is the case even for simply > comparing a bytes or buffer object to a str object ... Should a TypeError be raised as soon as you try to put a bytes and a string in the same dict, even if they don't happen to hash equal? (I assume that buffer(b'abc') in {} will raise a TypeError, just as list("abc") in {} would.) > Therefore, support for the PEP 3118 > buffer API will be removed from the str type. Good; this may be the single biggest aid for separting characters from a particular (bytes) representation. -jJ _______________________________________________ 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