[Python-Dev] PEP 309: Partial method application

Ian Bicking ianb at colorstudy.com
Thu Aug 18 22:57:38 CEST 2005

Brett Cannon wrote:
>>>What I think you want is not a partial method, instead, you want to
>>>turn a method into a standard function, and in a 'virtual' way.
>>>So I would propose the syntax
>>>  lst.sort(key=virtual.lower) # where virtual is functional.virtual
>>I like this, but would hope for a different name -- the poor word
>>'virtual' has been abused enough by C++.
> Yeah, me too.  Possible name are 'delayed', 'lazyattr', or just plain
> 'lazy' since it reminds me of Haskell.

I don't think there's anything particularly lazy about it.  It's like a 
compliment of attrgetter.  Where attrgetter is an inversion of getattr, 
partialmethod is an inversion of... well, of something that currently 
has no name.  There's kind of an implicit operation in obj.method() -- 
people will generally read that as a "method call", not as the retrieval 
of a bound method and later invocation of that method.  I think that is 
why it's so hard to figure out how to represent this in terms of 
something like attrgetter -- we try to invert something (a method call) 
that doesn't exist in the language.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Python-Dev mailing list