On 24Apr2012 13:23, Eric Snow <ericsnowcurrently@gmail.com> wrote: | In a function you can use a return statement to break out of execution | in the middle of the function. With modules you have no recourse. | This is akin to return statements being allowed only at the end of a | function. [...] Something very similar came up some months ago I think. My personal suggestion was: raise StopImport to cleanly exit a module without causing an ImportError, just as exiting a generator raises Stopiteration in the caller. In this case the caller is the import machinery, which should consider this except a clean completion of the import. Cheers, -- Cameron Simpson <cs@zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/ Disclaimer: Opinions expressed here are CORRECT, mine, and not PSLs or NMSUs.. - Larry Cunningham <larry@psl.nmsu.edu>