[Python-Dev] PEP 309: Partial method application

Shane Hathaway shane at hathawaymix.org
Thu Aug 18 22:13:31 CEST 2005


Martin v. Löwis wrote:
> So I would propose the syntax
> 
>   lst.sort(key=virtual.lower) # where virtual is functional.virtual

Ooh, may I say that idea is interesting!  It's easy to implement, too:

class virtual:
     def __getattr__(self, name):
         return lambda obj: getattr(obj, name)()
virtual = virtual()

Shane


More information about the Python-Dev mailing list