Bo Peng wrote:

> Is there a better way than doing
> 
> try:
>    import aModule
> except:
>    has_aModule = False
> else:
>    has_aModule = True
> 
> The main concern here is that loading aModule is unnecessary (and may 
> take time).

Yes.  Specifically catch ImportError in your except clause.

-- 
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Substance is one of the greatest of our illusions.
   -- Sir Arthur Eddington
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to