Message156531
| Author | tebeka |
|---|---|
| Recipients | tebeka |
| Date | 2012-03-22.01:09:18 |
| SpamBayes Score | 8.679244e-08 |
| Marked as misclassified | No |
| Message-id | <1332378559.49.0.430445927373.issue14384@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
This way they will behave more like getattr and the dictionary get.
If default is not specified, then if the item/attr not found, an execption will be raised, which is the current behavior.
However if default is specified, then return it in case when item/attr not found - default value will be returned.
I wanted this when trying to get configuration from a list of objects. I'd like to do
get = attrgetter('foo', None)
return get(args) or get(config) or get(env) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2012-03-22 01:09:19 | tebeka | set | recipients: + tebeka |
| 2012-03-22 01:09:19 | tebeka | set | messageid: <1332378559.49.0.430445927373.issue14384@psf.upfronthosting.co.za> |
| 2012-03-22 01:09:18 | tebeka | link | issue14384 messages |
| 2012-03-22 01:09:18 | tebeka | create | |