[Tutor] Exception handling - syntaxerror?!

Andrei project5 at redrival.net
Mon Sep 26 19:42:11 CEST 2005

Krishna wrote:
> When I have this piece of code in a function, it works fine. So is
> this some limitation of directly working out off the console?

It is indeed valid Python (you don't have to have empty lines after 
try-except in a real Python program).

> Seems the console supports complete code constructs only  I.e., I can
> have one complete try...except block, a if block etc., but not a bunch
> of constructs? Is my assumption correct?

That seems to cover it, one compound statement per >>>. (You can chain 
several statements in one line by using ';', e.g. ">>> print 6; print 5" 
will work just fine.



Mail address in header catches spam. Real contact info:
''.join([''.join(s) for s in zip(
"poet at aao.l pmfe!Pes ontuei ulcpss  edtels,s hr' one oC.",
"rjc5wndon.Sa-re laed o s npbi ot.Ira h it oteesn edt C")])

More information about the Tutor mailing list