[Python-Dev] creating __all__ in extension modules

Skip Montanaro skip@mojam.com (Skip Montanaro)
Fri, 2 Feb 2001 11:24:30 -0600 (CST)


    Fredrik> what's the point?  doesn't from-import already do exactly that
    Fredrik> on C extensions?

Consider os.  At one point it does "from posix import *".  Okay, which
symbols now in its local namespace came from posix and which from its own
devices?  It's a lot easier to do

    from posix import __all__ as _all
    __all__.extend(_all)
    del _all

than to muck about importing posix, looping over its dict, then
incorporating what it finds.

It also makes things a bit more consistent for introspective tools.

Skip