Who told str() to round my int()'s!!!

Diez B. Roggisch deets at nospam.web.de
Thu Aug 16 12:25:18 EDT 2007


John Nagle schrieb:
> A.T.Hofkamp wrote:
>> On 2007-08-15, Larry Bates <larry.bates at websafe.com> wrote:
>>
>>> or the mildy
>>> amusing "how do I write bytes not characters to a file" questions at 
>>> least once
>>> a week on this forum.
> 
>    Actually, that's a reasonable question, and one that Python didn't do
> quite right.
> 
>    Remember, in the beginning, Python had only ASCII strings, which
> were equivalent to arrays of bytes.  Then came Unicode strings.  Then
> came the restriction of ASCII chars to 0..127.  Except that you can
> still store binary bytes in ASCII strings, subject to some limitations.

Sorry, but that's bogus. Python had byte-strings from the beginning. 
Nothing to do with ASCII. Which is an encoding-standard that has ALWAYS 
been limited to the numbers 0..127.

All that changed was the introduction of unicode-objects and due to the 
fact that these need to be serialized to/from bytestrings the 
introduction of ASCII as default-encoding.

So no "still storing" or anything such.

Diez



More information about the Python-list mailing list