On Nov 15, 2011, at 1:58 PM, Jean-Michel Pichavant wrote:

> PS : @Dave there is a way to avoiding adding symbols to your global 
> namespace, assign None to the module's name on import errors. Then before 
> using it, just test the module bool value : if serial: serial.whateverMethod()

True, and that does avoid polluting namespace.  However, you shouldn't be 
testing for None as a bool; you should instead do an "if <module> is None:" 
(or, of course, "is not None").

- Dave

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to