[ANN] markup.py - 1.2 - an HTML/XML generator
Scott David Daniels
scott.daniels at acm.org
Mon Apr 3 20:34:25 EDT 2006
Erik Max Francis wrote:
> 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_`. `cls`, at least, is more commonly used within
> Python itself (e.g., classmethods).
While I liked the klass form myself, PEP-8 (the style guide) says:
Function and method arguments
Always use 'self' for the first argument to instance methods.
Always use 'cls' for the first argument to class methods.
If a function argument's name clashes with a reserved keyword,
it is generally better to append a single trailing underscore
rather than use an abbreviation or spelling corruption. Thus
"print_" is better than "prnt". (Perhaps better is to avoid
such clashes by using a synonym.)
Reference:
http://www.python.org/dev/peps/pep-0008/
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list