<div dir="ltr">Clearly there is SOME semantics that is consistent and coherent since many languages have either a lazy or eager declaration syntax, with different defaults between languages but both being built in. There are a lot of ways that Python isn't Haskell, obviously. But both Scheme and OCaml are eager by default with a lazy declaration (and Haskell or Miranda have an eager declaration correspondingly).<div><br></div><div>It might be worth looking at their semantics in the PEP.<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2017 at 7:57 AM, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.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 28.02.2017 15:46, Michel Desmoulin wrote:<br>
> lazy is not only practical, but it's also beautiful. It reads well. It<br>
> solves a problem we all have on a regular basis.<br>
<br>
</span>The only practical use case I ever ran into for lazy evaluation<br>
are lazy imports, simply because imports cause a lot of<br>
startup overhead. It's a case which the new keyword wouldn't<br>
help with, though.<br>
<br>
For the discussion, it would help if you'd write up a definition<br>
of where the lazy evaluation should finally happen, which use<br>
cases would be allowed or not and how the compiler could detect<br>
these.<br>
<br>
IMO, there are much better ways to write code which only evaluates<br>
expensive code when really needed.<br>
<br>
I don't see how "lazy" could automate this in a well defined,<br>
helpful and obvious way, simply because the side effects of moving<br>
evaluation from the place of definition to an arbitrary other place<br>
in the code are not easy to manage.<br>
<br>
Even if you do manage to clearly define when to evaluate a lazy<br>
expression, the context in which it gets evaluated may<br>
have already changed, giving wrong results, causing exceptions<br>
due to missing information. Delaying exceptions can also<br>
break the exception handling in your application.<br>
<br>
PS: You run into the same issues with lazy imports, which is<br>
why special care has to be taken when using these.<br>
<br>
--<br>
Marc-Andre Lemburg<br>
eGenix.com<br>
<br>
Professional Python Services directly from the Experts (#1, Feb 28 2017)<br>
>>> Python Projects, Coaching and Consulting ... <a href="http://www.egenix.com/" rel="noreferrer" target="_blank">http://www.egenix.com/</a><br>
>>> Python Database Interfaces ... <a href="http://products.egenix.com/" rel="noreferrer" target="_blank">http://products.egenix.com/</a><br>
>>> Plone/Zope Database Interfaces ... <a href="http://zope.egenix.com/" rel="noreferrer" target="_blank">http://zope.egenix.com/</a><br>
______________________________<wbr>______________________________<wbr>____________<br>
<br>
::: We implement business ideas - efficiently in both time and costs :::<br>
<br>
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48<br>
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg<br>
Registered at Amtsgericht Duesseldorf: HRB 46611<br>
<a href="http://www.egenix.com/company/contact/" rel="noreferrer" target="_blank">http://www.egenix.com/company/<wbr>contact/</a><br>
<a href="http://www.malemburg.com/" rel="noreferrer" target="_blank">http://www.malemburg.com/</a><br>
<div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons. Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div></div>