A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-March/002705.html below:

[Python-Dev] None as a keyword

[Python-Dev] None as a keyword / class methodsgvwilson@nevex.com gvwilson@nevex.com
Thu, 23 Mar 2000 12:10:16 -0500 (EST)
[The following passed the Ping test, so I'm posting it here]

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:

    def __init__(self, arg):
        ...as usual...

    def method(self, arg):
        ...no change...

    def classMethod(None, arg):
        ...equivalent of C++ 'static'...

p = Ping("thinks this is cool")    # as always
p.method("who am I to argue?")     # as always
Ping.classMethod("hey, cool!")     # no 'self'
p.classMethod("hey, cool!")        # also selfless


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.  I think both behaviors are readable;
the first provides genuinely new functionality, while I often found the
second handy when I was doing logic programming.

Greg




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4