Message195879
| Author |
zaytsev |
| Recipients |
alex, barry, chris.jerdonek, cvrebert, eric.smith, ezio.melotti, jcea, loewis, ncoghlan, pitrou, python-dev, rhettinger, zaytsev |
| Date |
2013年08月22日.11:54:09 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1377172449.35.0.494389782273.issue15806@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Hi Raymond,
This is a brilliant idea, but before it hits the streets, couldn't you possibly consider extending it with a kwarg to control the depth of the exception stack?
The use case I have for that are snippets like this:
with ignored(ValueError, TypeError), ignored(ValueError, TypeError), ignored(ValueError, TypeError):
a()
b()
c()
Or else I could write this as
with ignored(ValueError, TypeError):
a()
with ignored(ValueError, TypeError):
b()
with ignored(ValueError, TypeError):
c()
... but either way it looks bad. This looks a bit better to me:
with ignored(ValueError, TypeError, depth=3):
a()
b()
c()
If you deem this to be unacceptably unpythonic, then please ignore my suggestion. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年08月22日 11:54:09 | zaytsev | set | recipients:
+ zaytsev, loewis, barry, rhettinger, jcea, ncoghlan, pitrou, eric.smith, ezio.melotti, alex, cvrebert, chris.jerdonek, python-dev |
| 2013年08月22日 11:54:09 | zaytsev | set | messageid: <1377172449.35.0.494389782273.issue15806@psf.upfronthosting.co.za> |
| 2013年08月22日 11:54:09 | zaytsev | link | issue15806 messages |
| 2013年08月22日 11:54:09 | zaytsev | create |
|