Message263933
itemgetter(), attrgetter() and methodcaller() objects require one argument. They raise TypeError if less or more than one positional argument is provided. But they totally ignore any keyword arguments.
>>> import operator
>>> f = operator.itemgetter(1)
>>> f('abc', spam=3)
'b'
>>> f = operator.attrgetter('index')
>>> f('abc', spam=3)
<built-in method index of str object at 0xb7172b20>
>>> f = operator.methodcaller('upper')
>>> f('abc', spam=3)
'ABC'
Proposed patch makes these objects raise TypeError if keyword arguments are provided. |
|
Date |
User |
Action |
Args |
2016-04-21 19:23:41 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka |
2016-04-21 19:23:41 | serhiy.storchaka | set | messageid: <1461266621.67.0.0664681491354.issue26822@psf.upfronthosting.co.za> |
2016-04-21 19:23:41 | serhiy.storchaka | link | issue26822 messages |
2016-04-21 19:23:41 | serhiy.storchaka | create | |
|