<div dir="ltr"><div>I've pondered two PEPs that are in (friendly) competition with each other:<br><br>- PEP 549 -- Instance Descriptors (Larry Hastings)<br>- PEP 562 -- Module __getattr__ (Ivan Levkivskyi)</div><div><br></div><div>In the end I am *rejecting* PEP 549 and I hope to *accept* PEP 562, with a small addition to the latter to also support overriding __dir__ (so that one can provide a __dir__ implementation that matches the __getattr__ implementation, or perhaps counteracts it, in case one wants deprecated attributes to be omitted from dir() but still usable).</div><div><br></div><div>The __dir__ addition is mentioned here: <a href="https://github.com/ilevkivskyi/cpython/pull/3#issuecomment-343591293">https://github.com/ilevkivskyi/cpython/pull/3#issuecomment-343591293</a> .</div><div><br></div><div>A bit more motivation for my choice: re-reading PEP 549 reminded me of how its implementation is remarkably subtle (invoking Armin Rigo; for more details read <a href="https://www.python.org/dev/peps/pep-0549/#implementation">https://www.python.org/dev/peps/pep-0549/#implementation</a>). On the contrary, the implementation of PEP 562 is much simpler. With the Zen of Python in mind, this gives a hint that it is the better idea, and possibly even a good idea.</div><div><br></div><div>Ivan, once you've added the __dir__ thing to your PEP, please post it to python-dev to solicit review from its (larger) readership.<br></div><div><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>