FEEDBACK WANTED: Type/class unification
Christian Tanzer
tanzer at swing.co.at
Wed Aug 1 12:25:29 EDT 2001
"Andrew Dalke" <dalke at acm.org> wrote:
> Hernan M. Foffani <hfoffani at yahoo.com> wrote:
> > One minor suggestion:
> > I think it would help if you set a convention for the name
> > of the first argument in classmethods. Like self for standard
> > methods. Well, even self can "work" here, too.
>
> Guido:
> >I think 'self' would be confusing. I'd like to propose 'cls'.
>
> What's wrong with 'klass'? Other than that it looks either
> like a typo or like German. Several of the standard libraries
> use 'klass' when refering to a class and I've seen code outside
> the std. library using 'klass' as well. Whereas 'cls' is less
> frequently used in the std. library to hold a class, but I've
> not seen external uses of that name for that purpose elsewhere.
`klass` is broken German <wink>. Might be correct Dutch, though. To me
it seems wrong to use a non-english token in a programming languages
using English for all other names.
There were lots of proposals for this, all of them contentious to
someone or another:
arg-name pro con
--------------------------------------------------------------------
class obvious meaning clash with keyword
Class obvious meaning case sensitive
cls BDFL's choice pronunciation, non-obvious
clas closest to class non-obvious
self standard convention confusion between instance
and class methods
Self follows a common convention case sensitive
(class name capitalized,
instance name lower case)
type obvious meaning clash with builtin
cat cute (class and type) cute, non-obvious acronym
I'm glad that nobody proposed `class_` yet :-)
As the first argument can immediately signify a class method if the
same name is used by everybody it would be nice if an uncontentious
name popped up.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list