[Python-3000] PEP 3138- String representation in Python 3000

Joel Bender jjb5 at cornell.edu
Fri May 16 15:40:19 CEST 2008


> Fiddling with the name of the antonym doesn't help.
> The direction of "untransform" or whatever it's
> called is only as clear as the direction of
> "transform".

How about making the transformation parameter more descriptive?

    gzipped = plaintext.transform(plaintext_to_gzip)
    plaintext = gzipped.transform(gzip_to_plaintext)

I would rather have one function that can do lots of different 
transformations, the same name can be used for bytes and strings, the 
transformation can be subclassed, and it doesn't have to be reflexive if 
that doesn't make sense.

    somebytes.transform(ebcdic_to_plaintext)

OK, maybe that's no so common in YOUR world :-)

    pict = open('me.jpg', 'r').read()
    y = pict.transform(jpeg_to_png).transform(plaintext_to_base64)



Joel



More information about the Python-3000 mailing list