<div dir="ltr">If I have a package that defines both a __main__ and a __init__, then your change would bind the __main__ to the name instead of the __init__. That seems incorrect.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 9, 2015 at 1:12 AM, Andrew Barnert via Python-ideas <span dir="ltr"><<a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Aug 8, 2015, at 16:18, Cameron Simpson <<a href="mailto:cs@zip.com.au">cs@zip.com.au</a>> wrote:<br>
> I think I take the line that as of PEP 451 the conanical name for a module is .__spec__.name. The module's .__name__ normally matches that, but obviously in the case of "python -m" it does not.<br>
><br>
> As you point out, suddenly a module can appear somewhere other than sys.modules['__main__'] where that difference shows.<br>
><br>
> Let's ask the associated question: who introspects module.__name__ and expects it to be the cononical name? For what purpose?<br>
<br>
</span>I'd think the first place to look is code that deals directly with module objects and/or sys.modules--graphical debuggers, plugin frameworks, bridges (a la AppScript or PyObjC), etc. Especially since many of them want to retain compatibility with 3.3, if not 3.2, and to share as much code as possible with a 2.x version<br>
<br>
Of course you're probably right that there aren't too many such things, and they're also presumably written by people who know what they're doing and wouldn't have too much trouble adapting them for 3.6+ if needed.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<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/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br></div>