I'm still working on stricter enforcement of the "don't mix str and bytes" rule. I'm finding a lot of trivial problems, which are relatively easy to fix but time-consuming.
While doing this, I realize there are two idioms for converting a str to bytes: s.encode(e) or bytes(s, e). These have identical results. I think we can't really drop s.encode(), for symmetry with b.decode(). So is bytes(s, e) redundant? To make things murkier, str(b, e) is not quite redundant compared to b.encode(e), since str(b, e) also accepts buffer objects. But this doesn't apply to bytes(s, e) -- that one *only* accepts str. (NB: bytes(x) is a different API and accepts a different set of types.) -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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