PEP 318: Can't we all just get along?
Michael J. Fromberger
Michael.J.Fromberger at Clothing.Dartmouth.EDU
Wed Aug 18 21:14:07 EDT 2004
In article <mailman.1909.1092869465.5135.python-list at python.org>,
Paul Morrow <pm_mon at yahoo.com> wrote:
> Michael J. Fromberger wrote:
> >>
> >> def foo(cls, a, b): pass
> >>
> >>...I bet the majority would correctly guess "class".
> >
> > Well, given just that definition, the guess would be incorrect. The
> > current release of Python would also require:
> >
> > def foo(cls, a, b): pass # As defined above
> > foo = classmethod(foo)
>
> Actually, it illustrates the importance of proof-reading a post
> before posting it, which I didn't (sorry).
Understood, no worries.
> I should've also stated that the Python developers would be told that
> this is a special version of Python that automatically determines the
> type (static|class|instance) of a method. In that light, do you see
> how effective the visual convention can be?
Oh, I see it just fine -- but I still disagree with the idea of
including any such implicit magic in the language.
In fact, I don't like some of the magic that is already there -- such
as, for instance, the automatic mangling of class members whose names
begin with a double underscore to get "private" semantics. But that, at
least, is easy to avoid, if one doesn't want to use it.
> * If method's first param is 'self', it's an instance method.
> * If method's first param is 'cls' or 'klass', it's a class method.
> * All other methods are static methods.
Uck. -1 from me.
-M
--
Michael J. Fromberger | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
More information about the Python-list
mailing list