[ANN] markup.py - 1.2 - an HTML/XML generator
Felipe Almeida Lessa
felipe.lessa at gmail.com
Mon Apr 3 21:05:22 EDT 2006
Em Seg, 2006-04-03 às 17:20 -0700, Erik Max Francis escreveu:
> Felipe Almeida Lessa wrote:
>
> > IMHO, it's strange and ugly. Besides, AFAIK everybody uses "cls" or
> > "class_", this is the first place I see "klass", so this breaks
> > consistency, too. But that's just my opinion...
>
> A quick Google Groups search indicates that `klass` is more commonly
> mentioned than `class_`.
Well...
$ pwd
/usr/lib/python2.4/site-packages
$ grep -re klass . | wc -l
274
$ grep -re class_ . | wc -l
897
$ calc 897 / 274
~3.27372262773722627737
$ cd /tmp
$ svn co http://svn.python.org/projects/python/trunk/
A trunk/Python
A trunk/Python/codecs.c
A trunk/Python/thread_foobar.h
... [loads of files] ...
A trunk/pyconfig.h.in
A trunk/install-sh
U trunk
Gerado cópia de trabalho para revisão 43612.
$ grep -re klass trunk/ | wc -l
534
$ grep -re class_ trunk/ | wc -l
1720
$ calc 1720 / 534
~3.22097378277153558052
$ grep -re klass trunk/Lib/ | wc -l
340
$ grep -re class_ trunk/Lib/ | wc -l
1188
$ calc 1188 / 340
~3.49411764705882352941
For me that's enough. "class_" is used at least three times more than
"klass". Besides, as Scott pointed out, "class_" is prefered by the
guidelines too.
> `cls`, at least, is more commonly used within
> Python itself (e.g., classmethods).
Yes. cls wouldn't be a good choice. But class_ is. Or maybe even
css_class. But klass isn't.
--
Felipe.
More information about the Python-list
mailing list