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 tebeka
Recipients tebeka
Date 2008-10-14.22:07:30
SpamBayes Score 7.328892e-07
Marked as misclassified No
Message-id <1224022053.76.0.0750871741065.issue4124@psf.upfronthosting.co.za>
In-reply-to
Content
This is a patch for adding "default" keyword to itemgetter and attrgetter.

This way you can do:
>>> f = itemgetter(0, default=1)
>>> f([])
1
>>> f= attrgetter("a", default="b")
>>> f(object())
'b'
>>>

I'm not sure about all the Py_INCREF I've placed there, someone with
more knowledge than me should review the code.
History
Date User Action Args
2008-10-14 22:07:33tebekasetrecipients: + tebeka
2008-10-14 22:07:33tebekasetmessageid: <1224022053.76.0.0750871741065.issue4124@psf.upfronthosting.co.za>
2008-10-14 22:07:32tebekalinkissue4124 messages
2008-10-14 22:07:32tebekacreate