On 2018-09-07, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:
> On Thu, 06 Sep 2018 13:48:54 +0300, Marko Rauhamaa wrote:
>
>> Chris Angelico <ros...@gmail.com>:
>>> The request was to translate this into Python, not to slavishly imitate
>>> every possible semantic difference even if it won't actually affect
>>> behaviour.
>> 
>> I trust Steven to be able to refactor the code into something more
>> likable. His only tripping point was the meaning of the "let" construct.
>
> Thanks for the vote of confidence :-) 
>
> However I have a follow up question. Why the "let" construct in
> the first place? Is this just a matter of principle, "put
> everything in its own scope as a matter of precautionary code
> hygiene"? Because I can't see any advantage to the inner
> function:

let is a convenient way for functional languages to introduce new
names for things. You'd consider it wherever you'd consider
assigning something to a new name in Python. In this case, it was
probably just to avoid writing out that square root calculation
twice. Though you could use lambda calculus directly instead,
that might be considered painful, and the first thing you'd then
do is write a let macro.

-- 
Neil Cerutti
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to