Assignment versus binding

Steve D'Aprano steve+python at pearwood.info
Tue Oct 4 12:44:25 EDT 2016


On Tue, 4 Oct 2016 11:27 pm, Ben Bacarisse wrote:

> Haskell defines let (it's version of multiple mutually recursive
> bindings) in terms of the least fix point of a lambda function whose
> (pattern) parameter binds the expressions in the definitions.

It binds *the expression* itself? Not the value of the expression?

So Haskell uses some form of pass by name?

And (shamelessly using Python syntax) if I have a function:


def spam(x):
    print(x)
    print(x+1)


and then call it:

spam(time.sleep(60) or 1)


it will sleep for 60 seconds, print 1, then sleep for another 60 seconds,
then print 2. Is that right?



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list