Steven D'Aprano wrote:

> On Fri, 12 Jul 2013 07:36:30 +0000, Duncan Booth wrote:
> 
>> To be a convincing use-case you would have to show a situation where
>> something had to be both a static method and a utility method rather
>> than just one or the other and also where you couldn't just have both.
> 
> I have a class where I have a function that needs to be called both while
> the class is being constructed, and afterwards:
> 
> class Example:
>     @staticmethod
>     def do_stuff(arg):
>         ...
> 
>     do_stuff(23)  # This doesn't work.
> 
> Example.do_stuff(42)

That is a bit too abstract for my taste to count as a use-case. 

Also, as given the example will work in Python 3 when you remove the 
@staticmethod ;)

That said I can see that the error comes as a surprise and I would be fine 
with callable staticmethod objects.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to