Yet Another Case Question

Bengt Richter bokr at oz.net
Sun Feb 23 19:06:16 CET 2003


On Sun, 23 Feb 2003 05:25:57 +1100, "Tim Churches" <tchur at optushome.com.au> wrote:

>David Mertz, Ph.D. wrote
>>  - If names were case-insensitive, string literals would have to be so
>>    too.  With all due respect to my friend Tim Churches, this notion
>is
>>    just plain whacked.
>
>Hey, I haven't smoked anything for decades! True! It's bad for your
>health. 
>
>But I will re-iterate my whacked argument: one reason for
>case-sensitivity is that it avoids having to explain to beginners why
>the names of things are case-insensitive but the values of things are
>case-sensitive. Or put another way, the rule for the comparison of
>values of strings also applies to comparison of the names of strings
>(and the names of other things too). That sort of conceptual consistency
>is very Pythonic, even if it makes life less convenient. Add too many
>convenient special cases (like print >> file) and you end up with Perl.
>
>Tim C
>

In case anyone wants to start on eliminating case sensitivity, here are
use counts for multi-case names in files of the lib directory of 2.2.2:

---- d:\python22\lib\aifc.py ----
{'SetParams': 2, 'setparams': 2}
{'chunk': 28, 'Chunk': 3}
{'error': 3, 'Error': 40}
---- d:\python22\lib\asyncore.py ----
{'DEBUG': 2, 'debug': 2}
---- d:\python22\lib\audiodev.py ----
{'SUNAUDIODEV': 3, 'sunaudiodev': 3}
{'AL': 25, 'al': 11}
---- d:\python22\lib\BaseHTTPServer.py ----
{'message': 11, 'Message': 1}
---- d:\python22\lib\Bastion.py ----
{'BastionClass': 2, 'bastionclass': 2}
{'RExec': 1, 'rexec': 2}
---- d:\python22\lib\binhex.py ----
{'hexbin': 2, 'HexBin': 2}
{'creator': 2, 'Creator': 5}
{'binhex': 2, 'BinHex': 2}
{'flags': 2, 'Flags': 5}
{'FName': 2, 'fname': 8}
{'linelen': 4, 'LINELEN': 3}
{'FInfo': 11, 'finfo': 19}
{'type': 6, 'Type': 6}
---- d:\python22\lib\cgitb.py ----
{'name': 21, 'NAME': 1}
---- d:\python22\lib\cmd.py ----
{'cmd': 17, 'Cmd': 1}
{'prompt': 3, 'PROMPT': 2}
{'identchars': 2, 'IDENTCHARS': 2}
---- d:\python22\lib\codecs.py ----
{'reader': 12, 'Reader': 6}
{'writer': 8, 'Writer': 6}
---- d:\python22\lib\codeop.py ----
{'compile': 2, 'Compile': 2}
---- d:\python22\lib\Cookie.py ----
{'k': 6, 'K': 30}
---- d:\python22\lib\copy.py ----
{'C': 2, 'c': 2}
{'error': 3, 'Error': 2}
---- d:\python22\lib\dis.py ----
{'extended_arg': 4, 'EXTENDED_ARG': 2}
---- d:\python22\lib\doctest.py ----
{'tester': 7, 'Tester': 2}
---- d:\python22\lib\filecmp.py ----
{'BUFSIZE': 2, 'bufsize': 3}
---- d:\python22\lib\ftplib.py ----
{'FTP': 2, 'ftp': 9}
{'error': 5, 'Error': 6}
{'Netrc': 2, 'netrc': 2}
---- d:\python22\lib\gettext.py ----
{'MASK': 9, 'mask': 6}
{'catalog': 2, 'Catalog': 1}
---- d:\python22\lib\gzip.py ----
{'READ': 5, 'read': 17}
{'WRITE': 5, 'write': 15}
{'fname': 4, 'FNAME': 3}
---- d:\python22\lib\httplib.py ----
{'BUFSIZE': 2, 'bufsize': 4}
---- d:\python22\lib\ihooks.py ----
{'VERBOSE': 4, 'verbose': 14}
{'Hooks': 2, 'hooks': 27}
---- d:\python22\lib\imaplib.py ----
{'flags': 14, 'Flags': 2}
{'user': 2, 'USER': 4}
{'Literal': 2, 'literal': 15}
{'Debug': 4, 'debug': 14}
---- d:\python22\lib\imputil.py ----
{'importer': 5, 'Importer': 3}
---- d:\python22\lib\inspect.py ----
{'comment': 4, 'COMMENT': 1}
{'INDENT': 1, 'indent': 13}
{'name': 22, 'NAME': 1}
---- d:\python22\lib\mhlib.py ----
{'error': 23, 'Error': 21}
{'MH': 2, 'mh': 13}
{'multifile': 2, 'MultiFile': 1}
{'Folder': 2, 'folder': 4}
{'PATH': 2, 'path': 67}
---- d:\python22\lib\mimetypes.py ----
{'USAGE': 2, 'usage': 3}
---- d:\python22\lib\mimify.py ----
{'file': 9, 'File': 5}
{'I': 9, 'i': 9}
---- d:\python22\lib\os.py ----
{'path': 19, 'PATH': 2}
---- d:\python22\lib\pdb.py ----
{'Bdb': 3, 'bdb': 9}
{'repr': 2, 'Repr': 2}
{'Cmd': 3, 'cmd': 4}
---- d:\python22\lib\pickle.py ----
{'reduce': 7, 'REDUCE': 3}
{'None': 18, 'NONE': 3}
{'get': 4, 'GET': 3}
{'unicode': 7, 'UNICODE': 4}
{'INT': 3, 'int': 1}
{'long': 2, 'LONG': 3}
{'append': 33, 'APPEND': 3}
{'tuple': 3, 'TUPLE': 3}
{'list': 4, 'LIST': 3}
{'mark': 13, 'MARK': 8}
{'PUT': 3, 'put': 11}
{'inst': 4, 'INST': 3}
{'float': 1, 'FLOAT': 3}
{'dict': 4, 'DICT': 3}
---- d:\python22\lib\pipes.py ----
{'FILE': 2, 'file': 17}
---- d:\python22\lib\popen2.py ----
{'Popen3': 5, 'popen3': 5}
{'Popen4': 3, 'popen4': 3}
---- d:\python22\lib\pre.py ----
{'I': 1, 'i': 14}
{'m': 9, 'M': 1}
---- d:\python22\lib\profile.py ----
{'stats': 3, 'Stats': 2}
---- d:\python22\lib\pstats.py ----
{'Cmd': 2, 'cmd': 3}
{'stats': 34, 'Stats': 6}
---- d:\python22\lib\pyclbr.py ----
{'class': 2, 'Class': 4}
---- d:\python22\lib\pydoc.py ----
{'gui': 3, 'GUI': 2}
{'s': 4, 'S': 2}
{'i': 10, 'I': 2}
{'Scanner': 3, 'scanner': 9}
{'message': 2, 'Message': 5}
{'doc': 45, 'Doc': 3}
{'repr': 26, 'Repr': 6}
{'entry': 10, 'Entry': 1}
---- d:\python22\lib\Queue.py ----
{'Queue': 1, 'queue': 7}
{'empty': 1, 'Empty': 2}
{'Full': 2, 'full': 1}
---- d:\python22\lib\random.py ----
{'random': 46, 'Random': 2}
{'N': 23, 'n': 14}
{'VERSION': 3, 'version': 4}
---- d:\python22\lib\repr.py ----
{'Repr': 2, 'repr': 3}
---- d:\python22\lib\rexec.py ----
{'RExec': 2, 'rexec': 14}
{'Hooks': 2, 'hooks': 6}
---- d:\python22\lib\rfc822.py ----
{'AddressList': 4, 'addresslist': 20}
---- d:\python22\lib\robotparser.py ----
{'entry': 15, 'Entry': 5}
---- d:\python22\lib\smtpd.py ----
{'command': 16, 'COMMAND': 5}
{'data': 18, 'DATA': 3}
{'Options': 2, 'options': 15}
---- d:\python22\lib\smtplib.py ----
{'I': 1, 'i': 4}
{'hmac': 2, 'HMAC': 1}
---- d:\python22\lib\sre.py ----
{'Scanner': 1, 'scanner': 3}
{'SUBPATTERN': 2, 'SubPattern': 2}
{'pattern': 35, 'Pattern': 1}
{'I': 1, 'i': 8}
{'template': 14, 'TEMPLATE': 1}
{'m': 6, 'M': 1}
{'S': 1, 's': 9}
---- d:\python22\lib\sre_compile.py ----
{'NEGATE': 3, 'negate': 3}
{'charset': 20, 'CHARSET': 2}
{'assert': 3, 'ASSERT': 1}
{'RANGE': 4, 'range': 6}
{'IN': 2, 'in': 24}
{'LITERAL': 10, 'literal': 2}
---- d:\python22\lib\sre_constants.py ----
{'in': 2, 'IN': 3}
---- d:\python22\lib\sre_parse.py ----
{'flags': 11, 'FLAGS': 4}
{'LITERAL': 31, 'literal': 7}
{'SubPattern': 5, 'SUBPATTERN': 2, 'subpattern': 25}
{'Pattern': 2, 'pattern': 16}
{'in': 40, 'IN': 11}
---- d:\python22\lib\symtable.py ----
{'class': 5, 'Class': 2}
---- d:\python22\lib\telnetlib.py ----
{'debuglevel': 9, 'DEBUGLEVEL': 2}
---- d:\python22\lib\tempfile.py ----
{'macfs': 4, 'MACFS': 3}
---- d:\python22\lib\threading.py ----
{'_Verbose': 14, '_VERBOSE': 2}
{'Lock': 4, 'lock': 9}
{'Thread': 11, 'thread': 6}
---- d:\python22\lib\token.py ----
{'NAME': 1, 'name': 2}
---- d:\python22\lib\tokenize.py ----
{'COMMENT': 4, 'Comment': 3}
{'token': 23, 'Token': 2}
{'Name': 3, 'NAME': 1}
{'Number': 3, 'NUMBER': 1}
{'indent': 1, 'INDENT': 1}
{'STRING': 3, 'string': 2, 'String': 2}
{'ContStr': 2, 'contstr': 10}
---- d:\python22\lib\unittest.py ----
{'testLoader': 5, 'TestLoader': 3}
---- d:\python22\lib\urllib.py ----
{'ftp': 13, 'FTP': 1}
{'i': 31, 'I': 1}
{'ic': 4, 'IC': 1}
{'close': 14, 'Close': 1}
---- d:\python22\lib\urllib2.py ----
{'h': 20, 'H': 10}
---- d:\python22\lib\uu.py ----
{'error': 1, 'Error': 5}
---- d:\python22\lib\warnings.py ----
{'I': 1, 'i': 4}
---- d:\python22\lib\wave.py ----
{'chunk': 22, 'Chunk': 3}
---- d:\python22\lib\webbrowser.py ----
{'error': 1, 'Error': 2}
---- d:\python22\lib\xdrlib.py ----
{'error': 2, 'Error': 3}
---- d:\python22\lib\xmlrpclib.py ----
{'datetime': 2, 'DateTime': 5}
{'Binary': 5, 'binary': 2}
{'transport': 5, 'Transport': 3}
{'Parser': 1, 'parser': 16}
{'boolean': 1, 'Boolean': 5}
{'server': 3, 'Server': 1}
---- d:\python22\lib\zipfile.py ----
{'CRC': 16, 'crc': 2}

Regards,
Bengt Richter




More information about the Python-list mailing list