[Python-Dev] dir() and __all__

Benjamin musiccomposition at gmail.com
Sat Feb 16 04:29:23 CET 2008



On Feb 15, 9:18 pm, "Raymond Hettinger" <pyt... at rcn.com> wrote:
> [Raymond]
>
> >> Should dir(module) use __all__ when defined?
>
> [GvR]
>
> > It's not consistent with what dir() of a class or instance does though.
>
> > -1.
>
> Perhaps there is another solution. Have dir() exclude objects
> which are modules.  For example, dir(logging) would exclude
> sys, os, types, time, string, cStringIO, and traceback.
Are you proposing just a list those modules or all module objects?
Excluding all modules would endanger __init__.py modules which
imported modules from their package.
>
> Raymond
> _______________________________________________
> Python-Dev mailing list
> Python-... at python.orghttp://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv...


More information about the Python-Dev mailing list