This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients serhiy.storchaka
Date 2016-04-21.19:23:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461266621.67.0.0664681491354.issue26822@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-21 19:23:41serhiy.storchakasetrecipients: + serhiy.storchaka
2016-04-21 19:23:41serhiy.storchakasetmessageid: <1461266621.67.0.0664681491354.issue26822@psf.upfronthosting.co.za>
2016-04-21 19:23:41serhiy.storchakalinkissue26822 messages
2016-04-21 19:23:41serhiy.storchakacreate