<div dir="ltr">FYI, a lot of these ideas were discussed back in September and October of 2017 on this list if you search the subject lines for "startup" e.g. starting here and here:<div><a href="https://mail.python.org/pipermail/python-dev/2017-September/149150.html">https://mail.python.org/pipermail/python-dev/2017-September/149150.html</a><br><div><a href="https://mail.python.org/pipermail/python-dev/2017-October/149670.html">https://mail.python.org/pipermail/python-dev/2017-October/149670.html</a><br><div><br></div><div>At the end Guido kicked (at least part of) the discussion back to python-ideas.<div><br></div><div>--Chris</div></div></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 3, 2018 at 5:55 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</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 Fri, May 4, 2018 at 10:43 AM, Gregory P. Smith <<a href="mailto:greg@krypto.org">greg@krypto.org</a>> wrote:<br>
> I'd also like to see this concept somehow extended to decorators so that the<br>
> results of the decoration can be captured in the compiled pyc rather than<br>
> requiring execution at import time.  I realize that limits what decorators<br>
> can do, but the evil things they could do that this would eliminate are<br>
> things they just shouldn't be doing in most situations.  meaning: there<br>
> would probably be two types of decorators... colons seem to be all the rage<br>
> these days so we could add an @: operator for that. :P ... Along with a from<br>
> __future__ import to change the behavior or all decorators in a file from<br>
> runtime to compile time by default.<br>
><br>
> from __future__ import compile_time_decorators  # we'd be unlikely to ever<br>
> change the default and break things, __future__ seems wrong<br>
><br>
> @this_happens_at_compile_time(<wbr>3)<br>
> def ...<br>
><br>
> @:this_waits_until_runtime(5)<br>
> def ...<br>
><br>
> Just a not-so-wild idea, no idea if this should become a PEP for 3.8.  (the<br>
> : syntax is a joke - i'd prefer @@ so it looks like eyeballs)<br>
<br>
</span>At this point, we're squarely in python-ideas territory, but there are<br>
some possibilities. Imagine popping this line of code at the bottom of<br>
your file:<br>
<br>
import importlib; importlib.freeze_module()<br>
<br>
as a declaration that the dictionary for this module is now locked in<br>
and can be dumped out in whatever form is most efficient. Effectively,<br>
you're stating that you do not need any sort of dynamism (that call<br>
could be easily disabled for testing), and that, if the optimization<br>
breaks anything, you accept responsibility for it.<br>
<br>
How this would be implemented, I'm not sure, but that's no different<br>
from the @: idea.<br>
<br>
ChrisA<br>
<span class="">______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
</span>Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/chris.jerdonek%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>chris.jerdonek%40gmail.com</a><br>
</blockquote></div><br></div>