[I18n-sig] Strawman Proposal: Binary Strings

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 08 Feb 2001 18:16:39 +0000

On Thu, 8 Feb 2001 09:44:08 -0800 (PST), Paul Prescod
<paulp@ActiveState.com> wrote:

>  b.2. using a function called binary()

You say that precise coercion rules are a personal preference, but
adding a coercion function just helps this ambiguity to persist.

What if string.encode() returned a binary string.... would we need a
'binary()' builtin at all?

>They also follow
>Python's existing string->Unicode coercion rules.

I agree any explicit coecion should follow the same rules as Unicode.

Im not sure we agree on whether that coercion happens automatically
and implicitly, as it does with Unicode strings; I feel fairly
strongly that it shouldnt. (Ill justify that tomorrow if we do

An extra difference:

 d) The str() is the same as the repr().

I think this makes sense. The library reference says str() returns "a
nicely printable representation of an object" - and raw binary data
definitely isnt.  It gives users a chance to think about what they are
storing in the string.  Also, having repr the same as str is the same
as lists, dicts, and other 'data container' types.

Toby Dickenson