[Python-Dev] Changes to PEP 327: Decimal data type

Guido van Rossum guido at python.org
Wed Mar 17 22:15:28 EST 2004


> I just did an experiment which involved running the Python
> script appended below over the Library Reference index.
> The results were:
> 
> Total names: 1908
> lower_names: 1684
> Percent lower: 88.2599580713
> 
> An 88% majority seems like a fairly clear vote to me. :-)
> 
> ---------------------------------------------------------------------
> # Count function name styles from the Python Library Reference Index.
> import re, sys
> pat = re.compile(r"[A-Za-z_][A-Za-z0-9_]*\(\)")
> all = {}
> lc = {}
> for line in sys.stdin:
>   for word in pat.findall(line):
>     all[word] = 1
>     if word == word.lower():
>       lc[word] = 1
> print "Total names:", len(all)
> print "lower_names:", len(lc)
> print "Percent lower:", 100.0 * len(lc) / len(all)
> ---------------------------------------------------------------------

Now try that again but only look for names following 'def'.

You've counted all language keywords, builtins, modules, etc.

We should be looking for method and function definitions only.

OTOH, since Tim has Spoken, maybe we should just adopt alllowercase()
as the preferred convention. :)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list