[Python-Dev] Generalised String Coercion

François Pinard pinard at iro.umontreal.ca
Tue Aug 9 01:41:58 CEST 2005


[Phillip J. Eby]

> At 09:14 AM 8/8/2005 -0700, Guido van Rossum wrote:

> > I'm not going to change my mind on text() unless someone explains
> > what's so attractive about it.

> 2. It's more obvious to programmers that it's a *text* string rather
> than a string of bytes

I've no opinion on the proposal on itself, except maybe that "text",
that precise word or name, is a pretty bad choice.  It is far too likely
that people already use or want to use that precise identifier.

There once was a suggestion for naming "text" the module now known
as "textwrap", under the premise that it could be later extended for
holding many other various text-related functions.  Happily enough, this
idea was not retained. "textwrap" is much more reasonable as a name.

I found Python 1.5.2's "string" to be especially prone to clashing.  I
still find "socket" obtrusive in that respect.  Consider "len" as an
example of a clever choice, while "length" would not have been. "str" is
also a good choice. "object" is a bit more annoying theoretically, yet
we almost never need it in practice. "type" is annoying as a name (yet
very nice as a concept), as if it was free to use, it would often serve
to label our own things.  The fact is we often need the built-in.

Python should not choose common English words for its built-ins, without
very careful thought, and be reluctant to any compulsion in this area.

-- 
François Pinard   http://pinard.progiciels-bpi.ca


More information about the Python-Dev mailing list