[Python-3000] PEP 3138- String representation in Python 3000
Guido van Rossum
guido at python.org
Wed May 14 23:42:30 CEST 2008
On Wed, May 14, 2008 at 2:39 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> M.-A. Lemburg wrote:
>>>> On 2008年05月14日 18:33, Georg Brandl wrote:
>>>>>> M.-A. Lemburg schrieb:
>>>>>>>> Fine, so we need new methods for PyUnicode and PyString objects
>>>> which allow encoding and decoding using the same type (and enforce
>>>> the return types).
>>>>>>>> Any suggestions ?
>>>>>>>> How about these:
>>>>>>>> str.str_encode() -> str
>>>> str.str_decode() -> str
>>>>>>>> bytes.bytes_encode() -> bytes
>>>> bytes.bytes_decode() -> bytes
>>>>>> Cool, a naming contest :)
>>>>>> What about transform/untransform?
>>>> Not bad :-)
>>>> Here's a version without underscores:
>>>> str.encodestr() -> str
>> str.decodestr() -> str
>>>> bytes.encodebytes() -> bytes
>> bytes.decodebytes() -> bytes
>> A couple more possibilities (Guido is probably going to have to choose a
> colour for this bikeshed somewhere along the line...):
>> mystr.recodeto('unicode-escaped')
> mystr.recodefrom('unicode-escaped')
>> mybytes.recodeto('hex')
> mybytes.recodefrom('hex')
Nah. I'm still in favor of [un]transform. Let's just stick to that.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list