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.
Hmm, "methodcall"? As in: lst.sort(key=methodcall.lower) Where "methodcall" is something like what Shane described: class methodcall: def __getattr__(self, name): def delayedcall(*args, **kwds): return getattr(args[0], name)(*args[1:], **kwds) return delayedcall methodcall = methodcall() > > Oh, when should we think of putting reduce into functional? I > remember this was discussed when it was realized reduce was the only > functional built-in that is not covered by itertools or listcomps. I expected functional.map, functional.filter and functional.reduce to all exist in 2.5. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com