[Python-Dev] dir() and __all__
Guido van Rossum
guido at python.org
Sat Feb 16 05:20:09 CET 2008
More information about the Python-Dev mailing list
Sat Feb 16 05:20:09 CET 2008
- Previous message: [Python-Dev] dir() and __all__
- Next message: [Python-Dev] dir() and __all__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm not sure which use case you're after here, but I doubt it's what dir() was designed to do. dir() is meant to attempt to give you all attributes for which getattr() will succeed, barring dynamic overrides of __getattr[ibute]__. On Fri, Feb 15, 2008 at 7:18 PM, Raymond Hettinger <python 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. > > > Raymond > -- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] dir() and __all__
- Next message: [Python-Dev] dir() and __all__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list