[Python-3000] The case for unbound methods?
Steven Bethard
steven.bethard at gmail.com
Sat Mar 8 21:28:09 CET 2008
On Fri, Mar 7, 2008 at 8:47 PM, Anthony Tolle <artomegus at gmail.com> wrote:
> Let me put it this way: if unbound methods are gone for good, then I
> think it would nice to develop some guidance on checking the signature
> of callable objects, to enable decorators to play nice with each
> other--especially if they intend to modify the argument list.
[snip]
> For a static method:
> return self.callable(newarg, *args, **kwargs)
>
> For an instance method with instance binding (i.e. a bound method):
> return self.callable(newarg, *args, **kwargs)
>
> For an instance method with class binding (i.e. an unbound method):
> return self.callable(args[0], newarg, args[1:], **kwargs)
Why is it so crucial that "self" is the first argument? If I use a
decorator that adds a new element to the beginning of the argument
list, I wouldn't be surprised that I now have to write my methods as::
@add_initial_argument
def method(new_arg, self, ...):
...
Steve
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list