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).
It might be worth looking at their semantics in the PEP. On Tue, Feb 28, 2017 at 7:57 AM, M.-A. Lemburg <m...@egenix.com> wrote: > On 28.02.2017 15:46, Michel Desmoulin wrote: > > lazy is not only practical, but it's also beautiful. It reads well. It > > solves a problem we all have on a regular basis. > > The only practical use case I ever ran into for lazy evaluation > are lazy imports, simply because imports cause a lot of > startup overhead. It's a case which the new keyword wouldn't > help with, though. > > For the discussion, it would help if you'd write up a definition > of where the lazy evaluation should finally happen, which use > cases would be allowed or not and how the compiler could detect > these. > > IMO, there are much better ways to write code which only evaluates > expensive code when really needed. > > I don't see how "lazy" could automate this in a well defined, > helpful and obvious way, simply because the side effects of moving > evaluation from the place of definition to an arbitrary other place > in the code are not easy to manage. > > Even if you do manage to clearly define when to evaluate a lazy > expression, the context in which it gets evaluated may > have already changed, giving wrong results, causing exceptions > due to missing information. Delaying exceptions can also > break the exception handling in your application. > > PS: You run into the same issues with lazy imports, which is > why special care has to be taken when using these. > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Experts (#1, Feb 28 2017) > >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ > >>> Python Database Interfaces ... http://products.egenix.com/ > >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ > ________________________________________________________________________ > > ::: We implement business ideas - efficiently in both time and costs ::: > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > http://www.egenix.com/company/contact/ > http://www.malemburg.com/ > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/