case do problem

Andre Engels andreengels at gmail.com
Wed Mar 3 03:09:35 EST 2010


On Tue, Mar 2, 2010 at 6:46 PM, Tracubik <affdfsdfdsfsd at b.com> wrote:

>  and, generally
> speaking, the try..except block slow down the execution of the program or
> not?

Try...except tends to be slow when the exception does occur, fast when
it does not. Apart from that, if these
fraction-of-a-fraction-of-a-second gains are important to you, Python
is not the programming language for you.

In Python, it seems to be common to do optimization after rather than
during the main coding, and then only when it is necessary and only
where it matters. That is:
1. Program your solution without looking much at speed issues
2. Check if it is fast enough. If so, ready.
3. If not, see which parts of the program are being slow
4. Optimize only those parts of the program that have been identified in step 3

-- 
André Engels, andreengels at gmail.com



More information about the Python-list mailing list