Can __iter__ be used as a classmethod?

Samuele Pedroni pedronis at bluewin.ch
Thu Mar 6 08:38:37 EST 2003


"Alex Martelli" <aleax at aleax.it> ha scritto nel messaggio
news:89G9a.12708$pG1.332485 at news1.tin.it...
> Actually, a very typical use case for class methods (in Smalltalk at
> least) is for *factories* -- which of course are only useful for
> classes that ARE meant to be instantiated, because they typically
> return class instances.
>

yes.

On Smalltalk and class methods:

in Smalltak class methods are methods on the meta class, a meta class is
automatically created behind the scene for each class, and class methods are
only accessible through the class as in:

MyClass metamethod...

myinst class metamethod...

but:

myinst metamethod

would cause a message not understood exception.








More information about the Python-list mailing list