Movatterモバイル変換
[0]ホーム
[Python-Dev] PEP 309: Partial method application
Steven Bethardsteven.bethard at gmail.com
Fri Aug 19 07:33:36 CEST 2005
Josiah Carlson wrote:> Steven Bethard <steven.bethard at gmail.com> wrote:> > 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.>> I thought that:> operator.attrgetter() was for obj.attr> operator.itemgetter() was for obj[integer_index]My point exactly. If we're sticking to the same style, I would expect that for obj.method(*args, **kwargs)we would have something like: operator.methodcaller('method', *args, **kwargs)The proposal by Martin v. Löwis is that this should instead look something like: methodcall.method(*args, **kwargs)which is a departure from the current attrgetter() and itemgetter()idiom. I'm not objecting to this approach, by the way. I think withthe right name, it would probably read well. I just think that weshould try to be consistent one way or the other. If we go withMartin v. Löwis's suggestion, I would then expect that the corrolatesto attrgetter() and itemgetter() would also be included, e.g.: attrget.attr (for obj.attr) itemget[key] (for obj[key])STeVe-- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy
More information about the Python-Devmailing list
[8]ページ先頭