<div dir="auto">Sorry for top posting!  I'm on a phone. I still think the better way to solve the custom dir()  would be to change the module __dir__ method to check if __all__ is defined and use it to generate the result if it exists. This seems like a logical enhancement to me, and I'm planning on writing a patch to implement this. Whether it would be accepted is still an open issue though. <div dir="auto"><br></div><div dir="auto">Cody<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Sep 10, 2017 3:19 PM, "Nathaniel Smith" <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">The main two use cases I know of for this and PEP 549 are lazy imports of submodules, and deprecating attributes. If we assume that you only want lazy imports to show up in dir() and don't want deprecated attributes to show up in dir() (and I'm not sure this is what you want 100% of the time, but it seems like the most reasonable default to me), then currently you need one of the PEPs for one of the cases and the other PEP for the other case.<div dir="auto"><br></div><div dir="auto">Would it make more sense to add direct support for lazy imports and attribute deprecation to ModuleType? This might look something like metamodule's FancyModule type:</div><div dir="auto"><br></div><div dir="auto">    <a href="https://github.com/njsmith/metamodule/blob/ee54d49100a9a06ffff341bb10a4d3549642139f/metamodule.py#L20" target="_blank">https://github.com/njsmith/m<wbr>etamodule/blob/ee54d49100a9a06<wbr>ffff341bb10a4d3549642139f/<wbr>metamodule.py#L20</a></div><font color="#888888"><div dir="auto"><br></div><div dir="auto">-n</div></font></div></blockquote></div></div></div></div>