Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Why there is a parameter named "self" for classmethod function?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bruno Desthuilliers  
View profile  
 More options May 11 2009, 9:12 am
Newsgroups: comp.lang.python
From: Bruno Desthuilliers <bruno.42.desthuilli...@websiteburo.invalid>
Date: Mon, 11 May 2009 15:12:12 +0200
Local: Mon, May 11 2009 9:12 am
Subject: Re: Why there is a parameter named "self" for classmethod function?
Terry Reedy a crit :

> Kurt Symanzik wrote:

>> But you might consider decorating the method as a static method
>> instead since in your example you are not using the parameter at all.  
>> A static method would not require a parameter.

>> @staticmethod
>> def print_hello():
>>     print "hello"

> Functions that refer to neither the class nor an instance thereof can
> usually be moved outside the class altogether.  Python is not Java.

Indeed. But there are a couple uses for staticmethods - one of them
being polymorphic dispatch on the receiver object. And yes, I know,
modules are objects too, but this is not always an option (legacy code,
integration with a framework etc).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.