On 10 November 2017 at 22:27, Guido van Rossum <guido@python.org> wrote:
Picking up this thread as part of the PEP 562 and PEP 549 review. I like PEP 562 most, but I propose to add special-casing for `__dir__`. Not quite as proposed above (making the C level module_dir() look for `__all__`) but a bit more general -- making module_dir() look for `__dir__` and call that if present and callable. Ivan what do you think of that idea? It should be simple to add to your existing implementation. (https://github.com/ilevkivskyi/cpython/pull/3#issuecomment-343591293)

I like this idea. I was thinking about yet another option: *extending* the result of current dir() search by contents __all__ if present (not just returning contents of __all__).
But it looks like your idea covers more use cases, so I would stick with your idea.