Can __iter__ be used as a classmethod?
Erik Max Francis
max at alcyone.com
Fri Mar 14 23:12:14 CET 2003
"Phillip J. Eby" wrote:
> I think it would be better to say that staticmethod is the one that
> doesn't give any functionality. I also think staticmethod is poorly
> named, since it does not produce a method, and it definitely doesn't
> do what a 'static method' does in Java or any other language I know
Sure it does, at least in some circumstances:
>>> class C:
... def f(x): print "See?", x
... f = staticmethod(f)
>>> c = C()
The latter example wouldn't work if f (a staticmethod) weren't acting as
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ There is nothing wrong with sobriety in moderation.
\__/ John Ciardi
Physics reference / http://www.alcyone.com/max/reference/physics/
A physics reference.
More information about the Python-list