Message169326
| Author |
gd2shoe |
| Recipients |
gd2shoe |
| Date |
2012年08月29日.01:37:15 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1346204236.32.0.579082427996.issue15804@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I'm constantly finding myself writing itty-bitty try blocks like such:
process stuff
try : someSubProcess.kill()
except : pass
process stuff
I realize this isn't a rigorous use of except, but it's good enough for a vast majority of what I need it for. Still, it adds excess verbiage and makes code slightly harder to read.
All I need except to do most of the time is suppress exceptions. I think the language could be enhanced by making the except clause implicit.
the above would become:
process stuff
try : someSubProcess.kill()
process stuff
The intent remains clear. The code is cleaner and easier to read.
This does not happen often in rigorous code, but grep does find 3 counts in standard modules and 9 counts in numpy. I'm certain most prototype code (like mine) would greatly benefit. (My current 300 line project uses 4 so far.) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年08月29日 01:37:16 | gd2shoe | set | recipients:
+ gd2shoe |
| 2012年08月29日 01:37:16 | gd2shoe | set | messageid: <1346204236.32.0.579082427996.issue15804@psf.upfronthosting.co.za> |
| 2012年08月29日 01:37:15 | gd2shoe | link | issue15804 messages |
| 2012年08月29日 01:37:15 | gd2shoe | create |
|