Rather than decorators, how about sections?

Paul Morrow pm_mon at yahoo.com
Wed Aug 11 19:10:53 CEST 2004


Stefan Eischet wrote:

> Hi,
> 
> do we really need this stuff just to say "staticmethod" and 
> "classmethod"? How about:
> 
> class Foo(object):
>     def baz():
>         print "Static Method"
>     def bar(self):
>         print "Method"
>     def spam(Foo):
>         print "Class Method"
> 

I like it!  It's simple, clear, ... Why isn't this the hands-down best 
solution? Why do we want to be more verbose than necessary?

I wonder if there are people out there who've chosen something other 
than *self* for the 1st arg (shame on them if they did! <grin>) who's 
code this would break.  I've never understood why we didn't require that 
it be called self in the first place --- why give them more than one way 
to do *that*?





More information about the Python-list mailing list