How to use __all__ ?

Andrew Bennetts andrew-pythonlist at
Fri Feb 7 09:11:05 CET 2003

On Thu, Feb 06, 2003 at 11:35:33PM -0800, Paul Rubin wrote:
> I have a module,, containing
>    __all__ = ('a',)
>    a = 3
>    b = 5
> What's the story?  I thought b was supposed to be invisible, since
> it doesn't appear in x's __all__ list.  Is there some other way to
> get that effect?

__all__ only affects the "from x import *" statement.

There's no nice way to do what you want, although I suspect there are
probably nasty ones involving putting a proxy of some sort in sys.modules...


More information about the Python-list mailing list