Message74774
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. |
|
Date |
User |
Action |
Args |
2008-10-14 22:07:33 | tebeka | set | recipients:
+ tebeka |
2008-10-14 22:07:33 | tebeka | set | messageid: <1224022053.76.0.0750871741065.issue4124@psf.upfronthosting.co.za> |
2008-10-14 22:07:32 | tebeka | link | issue4124 messages |
2008-10-14 22:07:32 | tebeka | create | |
|