On Fri, Mar 2, 2018 at 10:44 AM, Ethan Furman <et...@stoneleaf.us> wrote:
> On 03/02/2018 09:34 AM, David Mertz wrote: > >> >>> with bind(sqrt(2), log(2)) as (a, b): >> ... print(a, b, a+b) >> 1.4142135623730951 0.6931471805599453 2.1073607429330403 >> >> This would cover 98% of the cases that I would want with the proposed >> statement-local name bindings. >> > > Cool! But what's the advantage over simple assignment? > The only difference from simple assignment is just visual and to be more self documenting. Basically, it just says (to me at least): "I intend to use these name within this block, but don't care about them elsewhere." It's sort of an informal scope without actual scoping rules. But of course, this is just existing Python, and anyone who wants to or doesn't is free to use or not use that style. In truth, I've thought about doing it from time to time, but never actually bothered in production code, just as a toy. -- 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/