<div dir="ltr"><div>I ave to agree with the other committers who already spoke up.<br><br></div>I'm not using tab completion much (I have a cranky old Emacs setup), but isn't making tab completion better a job for editor authors (or language-support-for-editor authors) rather than for the core language? What editor are you using that calls dir() for tab completion?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 17, 2017 at 7:34 PM, Cody Piersall <span dir="ltr"><<a href="mailto:cody.piersall@gmail.com" target="_blank">cody.piersall@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Sep 12, 2017 at 3:26 AM, Ivan Levkivskyi <<a href="mailto:levkivskyi@gmail.com">levkivskyi@gmail.com</a>> wrote:<br>
> @Cody<br>
>> I still think the better way<br>
>> to solve the custom dir()Â would be to change the module __dir__<br>
>> method to check if __all__ is defined and use it to generate the<br>
>> result if it exists. This seems like a logical enhancement to me,<br>
>> and I'm planning on writing a patch to implement this. Whether it<br>
>> would be accepted is still an open issue though.<br>
><br>
> This seems a reasonable rule to me, I can also make this patch if<br>
> you will not have time.<br>
<br>
I submitted a PR:<a href="https://github.com/python/cpython/pull/3610" rel="noreferrer" target="_blank">https://github.com/python/<wbr>cpython/pull/3610</a><br>
and a BPO issue: <a href="https://bugs.python.org/issue31503" rel="noreferrer" target="_blank">https://bugs.python.org/<wbr>issue31503</a><br>
<br>
R. David Murray pointed out that this is a backwards-incompatible<br>
change. This is technically true, but I don't know of any code that<br>
depends on this behavior. (Of course, that does not mean it does not<br>
exist!)<br>
<br>
>From my perspective, the big benefit of this change is that<br>
tab-completion will get better for libraries which are already<br>
defining __all__. This will make for a better REPL experience. The<br>
only code in the stdlib that broke were tests in test_pkg which were<br>
explicitly checking the return value of dir(). Apart from that,<br>
nothing broke.<br>
<br>
If a module does not have __all__ defined, then nothing changes for that module.<br>
<br>
Cody<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>