[Python-Dev] Unifying Long Integers and Integers: baseint

Skip Montanaro skip at pobox.com
Thu Aug 12 04:50:09 CEST 2004


    Greg> I can enivisage a future in which 'string' means unicode string,
    Greg> and byte sequences are called something else entirely, such as
    Greg> 'bytevector' or 'bytearray' (or maybe just 'array' :-).

After another couple minutes of thought:

    1. Maybe in 2.5 introduce a "bytes" builtin as a synonym for "str" and
       recommend its use when the intent is an arbitrary sequence of bytes.
       Add 'b' as a string literal prefix to generate a bytes object (which
       will really just be a string).  At the same time, start raising
       exceptions when non-ascii string literals are used without a coding
       cookie.  (Warnings are already issued for that.)

    2. In 2.6, make str a synonym for unicode, remove basestring (or also
       make it a synonym for unicode), make bytes its own distinct (mutable?
       immutable?) type, and have b"..." literals generate bytes objects.

Then again, maybe this can't happen until Py3K.  Before then we could do the
following though:

    1. Make bytes a synonuym for str.

    2. Warn about the use of bytes as a variable name.

    3. Introduce b"..." literals as a synonym for current string literals,
       and have them *not* generate warnings if non-ascii characters were
       used in them without a coding cookie.

PEP time?

Skip


More information about the Python-Dev mailing list