A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/042981.html below:

[Python-Dev] PEP 318 needs a rewrite

[Python-Dev] PEP 318 needs a rewriteGreg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 8 18:19:26 EST 2004
Guido:

> As a human reader, I like seeing the attributes before the arguments
> because some attributes (like classmethod and staticmethod) affect the
> interpretation of the argument list.

On the other hand, this weakens the syntactic parallels between
function definitions and function calls. Somehow, a def which doesn't
have an open paren immediately after the function name doesn't look
function-definition-ish to me.

With suitable argument naming conventions, the argument list itself
usually gives enough cues to make it clear if it's a classmethod or
staticmethod:

  def foo(self, x, y, z): 
    # self => it's a normal method

  def bar(cls, x, y, z) [classmethod]:
    # cls => it's a class method

  def baz(x, y, z) [staticmethod]:
    # neither self nor cls => it's a static method

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list

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