Re: about try and exception

2005-11-19 Thread Sybren Stuvel
Bruno Desthuilliers enlightened us with: > (Carl's top-post corrrected. Carl, please do not top-post) If you correct people and ask them to alter their posting style, at least make sure you post in a proper way. Snip what you're not directly referring to, so people don't have to scroll in order to

Re: about try and exception

2005-11-19 Thread Bruno Desthuilliers
Shi Mu a écrit : > On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > (Carl's top-post corrrected. Carl, please do not top-post) >> >> >>Ben Bush wrote: >> >>>I wrote the following code to test the use of "try...exception", >>>and I want n to be printed out. However, the following code'

Re: about try and exception

2005-11-17 Thread Alex Martelli
Shi Mu <[EMAIL PROTECTED]> wrote: ... > If we do not know when the error will happen during the calculation > but still want to continue till end, what should I do? > for example: > > def test(a,b,c): > return a/(b-c) > q=[1,1,2,2,4,6,9,0] > for i in range(len(q)): > print test(q[i],q[i

Re: about try and exception

2005-11-17 Thread Shi Mu
On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > > > >> I would think that when the exception occurs the interpreter exits the > >> block of code it is currently in and enters the exception block. > >> > >>

Re: about try and exception

2005-11-17 Thread Carl J. Van Arsdall
Shi Mu wrote: > On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > >> I would think that when the exception occurs the interpreter exits the >> block of code it is currently in and enters the exception block. >> >> Thus the line n = 1/2 would never get executed. >> >> >> -Carl >> >> B

Re: about try and exception

2005-11-17 Thread Shi Mu
On 11/17/05, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > I would think that when the exception occurs the interpreter exits the > block of code it is currently in and enters the exception block. > > Thus the line n = 1/2 would never get executed. > > > -Carl > > Ben Bush wrote: > > I wrote the

Re: about try and exception

2005-11-17 Thread Carl J. Van Arsdall
I would think that when the exception occurs the interpreter exits the block of code it is currently in and enters the exception block. Thus the line n = 1/2 would never get executed. -Carl Ben Bush wrote: > I wrote the following code to test the use of "try...exception", > and I want n to be

about try and exception

2005-11-17 Thread Ben Bush
I wrote the following code to test the use of "try...exception", and I want n to be printed out. However, the following code's output is: Traceback (most recent call last):  File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript    exec codeObject in _