[Tutor] understanding pydoc try

John Maclean jayeola at gmail.com
Thu Aug 30 15:30:52 CEST 2012


What does the first line from `pydoc try` actually mean? This does not 
look like the syntax that one is supposed to use.

try_stmt  ::= try1_stmt | try2_stmt

I can write simple statements as shown below, but I want to actually 
understand what I am doing.



try:
     import io
     print("importing io")
except ImportError:
     print("nothing to import")
     foo = None
try:
     import somefunctionthatdoesnotexist
     print("importing ...")
except ImportError:
     print("nothing to import")
     foo = None



More information about the Tutor mailing list