Class methods in 2.2a2
Aug. 27, 2001
3:41 a.m.
Self-less classes: it's now possible to define methods with no self argument. The methods may be invoked even with no instance of the class being created:
class foo: ... def add(a,b): ... return a+b ... add = staticmethod(add) ...
foo.add(3,4) 7 g = foo() g.add(1,2) 3
Yes, I've been reading the PEPs -- obviously. E.g.: http://python.sourceforge.net/peps/pep-0253.html Kirby
9058
Age (days ago)
9058
Last active (days ago)
1 comments
2 participants
participants (2)
-
agauld@crosswinds.net -
Kirby Urner