Can __iter__ be used as a classmethod?

Michele Simionato mis6 at pitt.edu
Wed Mar 19 19:57:10 CET 2003


Alex Martelli <aleax at aleax.it> wrote in message news:<6hZda.81274$pG1.1839790 at news1.tin.it>...
> Michele Simionato wrote:
>    ...
> >> > 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
>  ...
> >> regarding your objection to the name.  Where's the "definitely doesn't
> >> do" -- isn't a Python staticmethod just like e.g. a C++ static method?
>  ...
> >> What "definite" difference is totally escaping my notice...?
>  ...
> > A staticmethod is not a method, is a function, when called as in the
> 
> Nor did I say otherwise.  But I'm still totally puzzled by the
> "definitely doesn't do what a 'static method' does in Java" and I
> don't see how your answer addresses this.  What am I missing?
> 
> > this context) from regular methods(which now are functions). No difference
> > at all in the normal usage, but big difference in metaprogramming
> 
> In Java there are no "functions" distinct from static method, so that
> can't have anything to do with whatever the OP meant by "definitely
> doesn't do".  In C++ there is no introspection / reflection, and a
> static method IS also "a function" (you can take its address as a
> pointer to function, NOT as a pointer to method).  So, I'm still
> totally in the dark about what the "definitely doesn't do" refers
> to -- *how* does a Python staticmethod differ from Java's or C++'s???
> 
> 
> Alex

I don't claim expertise nor in Java nor in C++, therefore let the
OP to clarify this issue :)




More information about the Python-list mailing list