Message191083
| Author | mark.dickinson |
|---|---|
| Recipients | barry, brett.cannon, mark.dickinson, r.david.murray, rhettinger |
| Date | 2013-06-13.15:47:53 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1371138473.77.0.567799776638.issue18163@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
+1. I recently chastised a colleague for doing "raise KeyError(long_message)" instead of "raise KeyError(missing_item)". When I went to the standard library to support my POV, I found (to my chagrin) a big mix of the two styles.
>>> from collections import ChainMap
>>> d = ChainMap({}, {})
>>> try:
... d.pop('not there')
... except KeyError as e:
... key, = e.args
...
>>> key
"Key not found in the first mapping: 'not there'" |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2013-06-13 15:47:53 | mark.dickinson | set | recipients: + mark.dickinson, barry, brett.cannon, rhettinger, r.david.murray |
| 2013-06-13 15:47:53 | mark.dickinson | set | messageid: <1371138473.77.0.567799776638.issue18163@psf.upfronthosting.co.za> |
| 2013-06-13 15:47:53 | mark.dickinson | link | issue18163 messages |
| 2013-06-13 15:47:53 | mark.dickinson | create | |