[Python-Dev] email package status in 3.X
Stephen J. Turnbull
stephen at xemacs.org
Tue Jun 22 07:28:57 CEST 2010
Michael Urman writes:
> It is somewhat troublesome that there doesn't appear to be an obvious
> built-in idempotent-when-possible function that gives back the
> provided bytes/str,
If you want something idempotent, it's already the case that
bytes(b'abc') => b'abc'. What might be desirable is to make
bytes('abc') work and return b'abc', but only if 'abc' is pure ASCII
(or maybe ISO 8859/1).
Unfortunately, str(b'abc') already does work, but
steve at uwakimon ~ $ python3.1
Python 3.1.2 (release31-maint, May 12 2010, 20:15:06)
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str(b'abc')
"b'abc'"
>>>
Oops. You can see why that probably "should" be the case.
More information about the Python-Dev
mailing list