Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] PEP 309: Partial method application

Steven Bethardsteven.bethard at gmail.com
Thu Aug 18 23:20:09 CEST 2005


Martin v. Löwis wrote:> So I would propose the syntax>>   lst.sort(key=virtual.lower) # where virtual is functional.virtual Shane Hathaway wrote:> class virtual:>      def __getattr__(self, name):>          return lambda obj: getattr(obj, name)()> virtual = virtual()I think (perhaps because of the name) that this could be confusing.  Idon't have any intuition that "virtual.lower" would return a functionthat calls the "lower" attribute instead of returning a function thatsimply accesses that attribute.If we're going to move away from the itemgetter() and attrgetter()style, then we should be consistent about it and provide a solution(or solutions) that answers all of these problems:    obj.attr    obj.attr(*args, **kwargs)    obj[key]I'm not sure that there is a clean/obvious way to do this.STeVe-- You can wordify anything if you just verb it.        --- Bucky Katt, Get Fuzzy


More information about the Python-Devmailing list

[8]ページ先頭

©2009-2025 Movatter.jp