[Python-Dev] dir() and __all__
Aahz
aahz at pythoncraft.com
Sat Feb 16 05:49:18 CET 2008
On Fri, Feb 15, 2008, Raymond Hettinger 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.
-1
I see what you're getting at, but I think this level of introspection
breakage is a Bad Idea.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"All problems in computer science can be solved by another level of
indirection." --Butler Lampson
More information about the Python-Dev
mailing list