Case sensitivity

Terry Reedy tjreedy at udel.edu
Tue Feb 25 10:14:57 EST 2003


"Alex Martelli" <aleax at aleax.it> wrote in message
news:XxI6a.312928$AA2.11836039 at news2.tin.it...
> ...and the language's case sensitivity ends up forcing the
> highly various tastes of package authors on the users of said
> packages, who may have different tastes; indeed, if a user's
> module needs names from two modules A and B by disparate
> authors (and A and B might well both be in the standard
> Python library), then, "thanks" to case sensitivity, the
> user's module is forced into using a mishmash of conventions.

I agree that it is a wart on the Python Standard Library for GoodStuff
to have function goodstuff while somethingelse has function
SomethingElse.  I suspect that you are bite more often simply because
you probably make more extensive use of the lib than most.  Someone
who makes repeated use of,  say, five  modules will learn the name
quirks and forget that they ever were a problem.

I think the doctrine of "module writer's prerogative" was a mistake
and that BDFL should have been and be more 'dictatorial' in this
regard.  I cringe a bit when the author of itertools (whose efforts I
appreciate, which product I expect to use) invokes this doctrine (on
PyDev) to justify his naming convention.  Many have contributed at
least bits and pieces of design and implementation.  All of us will be
stuck with his choices indefinitely.

> Explicit rebindings at the start of the user's module may
> at least isolate this specific sub-wart.

Doing the rebinding at the top of each client module is obviously a
PITA,  Besides having to remember or check details, there is the
practical problem of retyping or cut-and-pasting.  An alternative
suggestion: develop (either alone or with c.l.p. help) the Alex
Martelli Standard Interface (AMSI) to modules and contents.  For each
'bad' module you use, write a 'good' wrapper that coerces names to
your standard.

# good.py: wraps bad.py

from bad import <oknames>
import bad
goodname = bad.badname
<etc>
del bad
__all__ = [<goodnames]

Put wrappers in directory amsilib.  Arrange for this to proceed the
standard lib.  Program more productively and happily thereafter.  And
make both amsilib and the installation script available to all who
wish to try it.

I think there is a deeper wart in the name area: the exclusion of '-',
the standard character in English for compound-word formation, as a
legal name character.  Its replacement in CS by '_' (shift-'-', ugh)
or by mid-word capitalization (another shift, ugh) has always struck
me as a priestly affectation.  I consider this to be a subtle but real
barrier to Computer Programming for Everybody.

Is it still possible to add '-' as a name (and re-word) character?  Or
does the implementation in C somehow prohibit this by requiring
conformance to C's name rule?

Terry J. Reedy







More information about the Python-list mailing list