473,325 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Using try and catch

440 256MB
Hi,

Is ussage of try and catch block will slow down the application execution process,even it will help the application from crashing or giving error messages etc?.

-PSB
Apr 30 '07 #1
1 5641
bartonc
6,596 Expert 4TB
Hi,

Is ussage of try and catch block will slow down the application execution process,even it will help the application from crashing or giving error messages etc?.

-PSB
The trick is deciding what to "wrap" in the try block: Inside a loop that may throw only one type of error would be a poor decision. Outside of loops, there is no down-side to catching errors. For example:
Expand|Select|Wrap|Line Numbers
  1. try:
  2.     while True:
  3.         aValue = aList[anIndex]
  4.         # ...
  5. except IndexError:
  6.     print 'got an index error'
will only do good things for you app.
Apr 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Abhishek Srivastava | last post by:
Hello All, I have seen code snippets like try { ..... } catch {
6
by: cody | last post by:
Mostly always you use the using clause you deal with native ressources, so exception handlinjg is sooner or later inevitable. so why do we need to write try { using (File f =...
1
by: gemel | last post by:
I wish to implement error recovery using the Exception mechanism However, I'm not sure I fully appreciate some of the detail in which this works. The code that contains a potential error is...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.