Callable or not callable, that is the question!
Peter Otten
__peter__ at web.de
Fri Jul 12 06:36:55 EDT 2013
More information about the Python-list mailing list
Fri Jul 12 06:36:55 EDT 2013
- Previous message (by thread): Callable or not callable, that is the question!
- Next message (by thread): Oportunidade: Estagiário (Wanna-be-developer) - RJ
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message (by thread): Callable or not callable, that is the question!
- Next message (by thread): Oportunidade: Estagiário (Wanna-be-developer) - RJ
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list