[Python-Dev] None as a keyword / class methods
Thu, 23 Mar 2000 09:47:47 -0800 (PST)
On Thu, 23 Mar 2000 email@example.com 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:
> class Ping:
Ack! I've been reduced to a class with just three methods.
Oh well, i never really considered it a such a bad thing
to be called "simple-minded". :)
> def classMethod(None, arg):
> ...equivalent of C++ 'static'...
Yeah, i agree with Jim; you might as well call this a "static
method" as opposed to a "class method".
I like the way "None" is explicitly stated here, so there's
no confusion about what the method does. (Without it, there's
the question of whether the first argument will get thrown in,
Hmm... i guess this also means one should ask what
def function(None, arg):
does outside a class definition. I suppose that should simply
> 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())
> instead of having to create throw-away variables to fill in slots in
> tuples that they don't care about.
For what it's worth, i sometimes use "_" for this purpose
(shades of Prolog!) but i can't make much of an argument
for its readability...
I never dreamt that i would get to be
The creature that i always meant to be
But i thought, in spite of dreams,
You'd be sitting somewhere here with me.