How do I do this without class methods ?

Martin von Loewis loewis at informatik.hu-berlin.de
Wed Apr 25 04:54:21 EDT 2001


Jacek Generowicz <jmg at ecs.soton.ac.uk> writes:

> # This only works, for the base class (no surprise)
> def welease_bwian( N ):
>     woderwick.wodger = woderwick.bwian[N]

How about

def welease_bwian(klasse, N):
  klasse.wodger = klasse.bwian[N]

So, instead of writing roderick.welease_bwian(3), you'd write
welease_bwian(roderick, 3)

In most languages with static methods, you cannot do this, since
classes are not first class objects (or maybe they are, but have other
funny limitations).

Regards,
Martin



More information about the Python-list mailing list