>>>>> "John" == John Barham <[EMAIL PROTECTED]> writes:

>> * import readline or emptymodule

John> This I find more problematic as "emptymodule" seems too magical.
John> Even now any code that wants to use a module that might not have been
John> successfully imported needs to check if that's the case.  E.g., a
John> fuller current use-case would be:

John> try:
John>    readline = None
John>    import readline
John> except ImportError:
John>    pass

John> if readline is not None:
John>    readline.foo()

John> Conceivably emptymodule could act as a Null object but that could
John> create more problems than it solves.

How about

import readline or None as readline

This is just for cases where you don't want to trigger ImportException on
import and do want the symbol set to None for later testing. A standalone
"import None" could have no effect.

Terry
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to