Re: Make staticmethod objects callable?
- From: Steven Bethard <steven.bethard@xxxxxxxxx>
- Date: Tue, 28 Feb 2006 14:57:46 -0700
Nicolas Fleury wrote:
I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work:
class A:
@staticmethod
def foo(): pass
bar = foo()
Do you have a real-world use case? I pretty much never use staticmethods (preferring instead to use module-level functions) so I'm having a hard time coming up with some code where this would be really useful. I'm also a little wary of breaking the parallel between classmethod and staticmethod which are currently *just* descriptors (without any other special functionality).
Maybe instead of making just staticmethods callable, both staticmethods and classmethods could gain an 'im_func' attribute like bound and unbound methods have?
STeVe
.
- References:
- Make staticmethod objects callable?
- From: Nicolas Fleury
- Make staticmethod objects callable?
- Prev by Date: Re: PEP 354: Enumerations in Python
- Next by Date: Re: Make staticmethod objects callable?
- Previous by thread: Make staticmethod objects callable?
- Next by thread: Re: Make staticmethod objects callable?
- Index(es):
Relevant Pages
|
|