A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-August/017284.html below:

[Python-Dev] Customizing the binding of attributes

[Python-Dev] Customizing the binding of attributes [Python-Dev] Customizing the binding of attributesThomas Heller thomas.heller@ion-tof.com
Fri, 24 Aug 2001 20:57:04 +0200
[I wrote]
> > - Shouldn't (my)instancemethod be a builtin? Similar to
> > staticmethod and classmethod?
> 
> Yes.  I just checked this in.  The new name is 'getset' unless you
> have a better idea.

I wasn't talking about your getset object (which is already mentioned
in the PEP), I was thinking of an 'instancemethod' object,
which would accept any callable (for example a *function*
implemented in an extension module), and convert it into an unbound
or bound method when retrieved from a class or an instance.
Something like

class instancemethod(object):
    def __init__(self, callable):
        self.callable = callable

    def __get__(self, inst, klass=None):
        import new
        return new.instancemethod(self.callable, inst, klass)

only faster ;-)

Thomas        




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4