coding style - where to declare variables

Marko Rauhamaa marko at pacujo.net
Sun Jul 22 15:50:52 EDT 2018


ram at zedat.fu-berlin.de (Stefan Ram):
>>Rebinding names is near-universal in programming, but usually names
>>that are intended to be rebound, such as variables.
>
>   To someone like me who has grown up with a LISP 1
>   this is completely natural.
>
> |>( SETQ A ( LAMBDA () 'ALPHA ))
> |(LAMBDA () 'ALPHA)

"Setq" is the dirty little secret of LISP.

Scheme marks its shameful primitives with an exclamation mark. Thus, its
assignment primitive is "set!".

I wish people stopped talking about "name binding" and "rebinding,"
which are simply posh synonyms for variable assignment. Properly, the
term "binding" comes from lambda calculus, whose semantics is defined
using "bound" and "free" variables. Lambda calculus doesn't have
assignment.

More about variable binding here: <URL:
https://en.wikipedia.org/wiki/Free_variables_and_bound_variables>


Marko



More information about the Python-list mailing list