[Python-Dev] None as a keyword / class methods
Christian Tismer
tismer@tismer.com
Thu, 23 Mar 2000 20:27:53 +0100
Mark Hammond wrote:
>
> ...
> > If None becomes a keyword, I would like to ask whether it could be used to
> > signal that a method is a class method, as opposed to an instance method:
> >
> > def classMethod(None, arg):
> > ...equivalent of C++ 'static'...
> ...
>
> > I'd also like to ask (separately) that assignment to None be defined as a
> > no-op, so that programmers can write:
> >
> > year, month, None, None, None, None, weekday, None, None =
> > gmtime(time())
>
> In the vernacular of a certain Mr Stein...
>
> +2 on both of these :-)
me 2, äh 1.5...
The assignment no-op seems to be ok. Having None as a place
holder for static methods creates the problem that we loose
compatibility with ordinary functions.
What I would propose instead is:
make the parameter name "self" mandatory for methods, and turn
everything else into a static method. This does not change
function semantics, but just the way the method binding works.
> [Although I do believe "static method" is a better name than "penguin" :-]
pynguin
--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home