[Python-ideas] "try with" syntactic sugar
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Feb 27 20:04:10 CET 2009
Daniel Stutzbach wrote:
> <another way to get to possibly relevant code>
It seems to me the question is, among the single-statement try blocks,
what kinds of (non-function call, non-assignment) statements are the
inner statement, and what frequency does this occur.
On Python5, 25, and 30, I get quite similar numbers:
2.5 2.6 3.0
10 15 14 with
15 11 13 yield
25 26 22 class
32 23 *8 print # print is a function in 3.0, called 8 times
37 33 24 while
44 35 *26 exec # exec is a function in 3.0, called 26 times
9 42 41 pass
49 44 64 raise
67 45 29 del
95 61 40 for
142 68 42 if
182 105 63 from
230 163 107 import
588 307 150 return
These numbers are pulled from the output of the attached
imperfect program, and hand-editted together. The numbers
seem to me to say that try-for and try-while substantially
exceed try-with statements.
--Scott David Daniels
@Acm.Org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hunt_try.py
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090227/86ca9783/attachment.ksh>
More information about the Python-ideas
mailing list