[Python-Dev] C-API status of Python 3?

M.-A. Lemburg mal at egenix.com
Mon Mar 3 00:13:39 CET 2008


On 2008-03-02 20:39, Bill Janssen wrote:
>> Why not also make unicode() the default type constructor and only
>> keep str() as alias to simplify porting (perhaps with a warning) ?
>>
>> The term "string" is just too overloaded with all kinds of
>> misinterpretations. The term "string" just refers to a string of
>> bytes - a variable length array so to speak. However, depending
>> on the application space, "string" is used as synonym for
>> "text string" just as well as "data string".
>>
>> Removing the term "string" altogether would make it easier for
>> people to understand that Py3k only has unicode (for text data)
>> and bytes (for binary data).
> 
> I agree that "string" is very overloaded, but calling it "unicode" is
> sort of like calling integers "int32" -- that is, you're talking about
> the implementation rather than the type. 

Hmm in that case, we'd have to call it "ucs2" or "ucs4" depending
on how Python was compiled ;-)

> In most programming
> languages that aren't at the machine level (like C is), "string"
> really is a sequence of text characters, not a "string of bytes", and
> that's probably the term that should be used for Python going forward,
> despite the legacy issues it involves.

I'm not bound to "unicode" at all, just don't think using "string"
for text data will really make people think twice often enough
and then you end up having binary data in a "string" again -
with the only difference that it's now using the Unicode type
internally.

My personal favorite is "text" for text data.

> Personally, I feel that "string" (for text) and "bytes" (for binary
> data represented as a sequence of bytes) are appropriate terms for
> Python.  Keep "unicode" for a release or two as an alias for "string".
> But isn't all this in a PEP somewhere already?

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Mar 03 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-Dev mailing list