[Python-Dev] Syntax suggestion for imports

Aahz aahz at pythoncraft.com
Thu Jan 3 19:11:58 CET 2008


On Wed, Jan 02, 2008, Raymond Hettinger wrote:
>
> Before posting, I ran some scans of our code base at work and found
> plenty of examples (mostly third-party cmodules vs python equivalents
> and a few that searched for similar functionality in different
> packages).  It might be helpful if others were to also search their
> own code bases and post their findings:
>
>   find . -name "*py" | xargs grep -C2 ImportError *py

Most of my company's examples fall into cases like this:

try:
    klass = load_class(foo)
except ImportError:
    klass = NullClass
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.


More information about the Python-Dev mailing list