[Python-3000] PEP 3138- String representation in Python 3000
M.-A. Lemburg
mal at egenix.com
Wed May 14 19:24:11 CEST 2008
On 2008-05-14 18:33, Georg Brandl wrote:
> M.-A. Lemburg schrieb:
>>>> In summary, I'd just like to see the following happen:
>>>>
>>>> * revert the type restrictions on the PyCodec_* API
>>>>
>>>> * enforce the restrictions on the .encode() and .decode()
>>>> methods of PyUnicode and PyString objects (str and bytes)
>>>>
>>>> * add a way to PyUnicode and PyString objects (str and bytes)
>>>> to allow same type encoding and decoding
>>>
>>> +1
>
> Will this get use the hex, base64 etc. "codecs" back? If yes, great!
I suppose so :-)
Those would work only work on bytes, though, so to convert
the result into text, you'd have to do:
text = bytes.encodebytes('hex').decode('ascii')
bytes = text.encode('ascii').decodebytes('hex')
>> 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
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, May 14 2008)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-3000
mailing list