howto check does module 'asdf' exist? (is available for import)

Paul Rubin http
Tue May 22 23:17:10 EDT 2007


kaens <apatheticagnostic at gmail.com> writes:
> I think that's there because you just wanted to check if it was
> available for import, implying that you didn't actually want to import
> it right then.

Whether it's available for import and whether you've already imported
it are two separate questions.  Maybe you said "import fghj as asdf"
and now you want to find out if there's another module actually named
asdf.  It would be cleaner if there's a method with no side effects.



More information about the Python-list mailing list