PEP 318

Ronald Oussoren oussoren at cistron.nl
Mon Mar 22 09:40:24 EST 2004


On 22-mrt-04, at 13:51, David M. Wilson wrote:

> Ville Vainio <ville at spammers.com> wrote...
>
>> The current foo=staticmethod(foo) makes the Python 'staticmethod' seem
>> like a hack. Many users of staticmethod won't even need to know that
>> wrapping takes place.
>
> I find myself in diametric opposition here. :)
>
> Users (read: developers) /should/ know how staticmethod is working
> under it's skin, that's (and hopefully no-one here disagrees) a bloody
> good thing. The fact that defining a static method is a simple
> assignment tells the developer a lot more about Python's internal
> workings than extra syntax does. It's far more general, it's explicit,
> and it's readable.

It's only readable in very small examples, if you have functions that 
are longer than 10 lines it is no longer obvious that the assigment has 
anything to do with the function above.

To play devil's advocate, 'class Foo: pass' is also syntactic sugar, 
having explicit calls to type also tells a developer more about the 
inner workings of Python but that is not necessarily a good idea.

Ronald
--
X|support bv            http://www.xsupport.nl/
T:  +31 610271479       F:  +31 204416173





More information about the Python-list mailing list