Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] PEP 309: Partial method application

Steven Bethardsteven.bethard at gmail.com
Thu Aug 18 18:34:00 CEST 2005


Raymond Hettinger wrote:> [Ian Bicking]> > I think partial() misses an important use case of method getting, for> > instance:> >> >      lst = ['A', 'b', 'C']> >      lst.sort(key=partialmethod('lower'))>> We've already got one:>>        lst.sort(key=operator.attrgetter('lower'))Doesn't that just sort on the str.lower or unicode.lower method object?py> sorted(['A', u'b', 'C'], key=operator.attrgetter('lower'))[u'b', 'C', 'A']py> sorted(['A', u'b', 'C'], key=partialmethod('lower')) # afterfixing arg -> args bug['A', u'b', 'C']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