Newbie question: how to join a list of elements of user-defined types?

Kragen Sitaker kragen at pobox.com
Tue May 7 05:24:34 EDT 2002


Alex Martelli <aleax at aleax.it> writes:
> Kragen Sitaker wrote:
>         ...
> > Apparently; class members and methods are a brand new addition in
> > Python 2.2.  I think they are a major design error; they add no power
> > but significant complexity to the language, and they are clumsy to
> > use and bug-prone.
> 
> The complexity that staticmethod adds to the language is no more 
> than would be added by defining its 2.1 equivalent, of course:
> 
> class staticmethod:
>     def __init__(self, callable): self.__call__=callable

That is true.

> So, the complexity can't really be much (about on a par with the rather
> modest usefulness).  I suspect that's not one of the issues you're
> addressing, but it's hard to say given that "class members" mystery.

Well, I think I was confused when I wrote that, and I'm not really
sure what I was thinking.

I guess I have this vague idea that encouraging people to write
"foo=staticmethod(foo)" in their class definitions is going to make
their code harder to understand, because now you have expressions that
look like method calls, running code that looks like a method
definition, but with different semantics.  It's rather as if somebody
sat down and thought about ways to make Python code harder to
understand.

That said, I haven't actually tried to debug other people's code that
uses staticmethod, and there are lots of language features that sound
nasty until you try them.




More information about the Python-list mailing list