Roman numeral function

0 views
Skip to first unread message

jrw...@gmail.com

unread,
Jan 14, 2008, 2:50:32 PM1/14/08
to billmill.org discussion
I'm relatively new to Python, but I was wondering if using the try/
except block to control normal program flow (i.e., it's being used in
place of a conditional) creates performance problems. Every iteration
is entering the try/except block, and the TypeError will always be
thrown for valid Roman numerals. Is this considered something to
avoid in Python programming? I know that it's widely considered a no-
no to control program flow this way in Java programming, but part of
the reason for this convention in Java is due to JVM implementations
handling exceptions far more slowly than if/else blocks. For all I
know, the Python interpreter could be implemented much differently.
Is this the case with Python as well, or are try/except blocks in
Python commonly used to control program flow and not just handle
"exceptional" circumstances?

Bill Mill

unread,
Jan 14, 2008, 3:09:12 PM1/14/08
to billmill.org discussion
> or are try/except blocks in Python commonly used to control program flow

Yup; there's a good discussion of it in the reddit comments:

http://programming.reddit.com/info/65bpf/comments/c02vwva

-Bill
Reply all
Reply to author
Forward
0 new messages