[Python-Dev] email package status in 3.X
Guido van Rossum
guido at python.org
Tue Jun 22 18:49:27 CEST 2010
On Mon, Jun 21, 2010 at 10:28 PM, Stephen J. Turnbull
<stephen at xemacs.org> wrote:
> 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).
No, no, no! That's just what Python 2 did.
> 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.
There is a near-contract that str() of pretty much anything returns a
"printable" version of that thing.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev
mailing list