classmethod() not inherited?

Aahz aahz at pythoncraft.com
Tue Jan 21 04:40:20 CET 2003


In article <m38yxl8k7y.fsf at mira.informatik.hu-berlin.de>,
Martin v. =?iso-8859-15?q?L=F6wis?= <martin at v.loewis.de> wrote:
>
>class Person:
>  minage = 0
>  maxage = 100
>  def span(self):
>    return self.maxage-self.minage
>  span=classmethod(span)

Why are you using 'self' instead of 'cls'?  I think having the reminder
that span is a classmethod is a Good Idea.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ




More information about the Python-list mailing list