Assignment versus binding

Marko Rauhamaa marko at pacujo.net
Tue Oct 4 15:10:18 EDT 2016


Steve D'Aprano <steve+python at pearwood.info>:

> 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?

Don't know about Haskell, but in a truly functional programming language
it wouldn't make a difference.

> 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?

A truly functional programming language wouldn't have side effects (in
this case, it wouldn't sleep).


Marko



More information about the Python-list mailing list