Message156592
IMO in the case of multiple items/attrs then you return default in their place:
attrgetter('x', 'y', default=7)(None) => (7, 7)
In case of dotted attribute again it'll return default value of any of the attributes is not found:
attrgetter('x.y', default=7)(None) => 7
BTW: This is inspired from Clojure's get-in (http://bit.ly/GGzqjh) function.
I'll bring this up in python-ideas. |
|
Date |
User |
Action |
Args |
2012-03-22 16:46:27 | tebeka | set | recipients:
+ tebeka, r.david.murray |
2012-03-22 16:46:27 | tebeka | set | messageid: <1332434787.76.0.413820575606.issue14384@psf.upfronthosting.co.za> |
2012-03-22 16:46:27 | tebeka | link | issue14384 messages |
2012-03-22 16:46:27 | tebeka | create | |
|