Avoiding local variable declarations?
Jorgen Grahn
grahn+nntp at snipabacken.se
Mon Nov 17 05:10:16 EST 2008
On Thu, 13 Nov 2008 12:49:02 -0800 (PST), dpapathanasiou <denis.papathanasiou at gmail.com> wrote:
...
>> but what's wrong with you original code?
>
> I come from a functional programming school of thought, where you
> avoid local variable declarations if at all possible.
I'm not sure that's universal. Using Standard ML at Uni, it was often
useful to use "let name = expr in expr" (or whatever the syntax was)
to simplify an expression. Directly borrowed from mathematics, I
assume.
'name' is not a variable, of course; there are no variables in
functional programming. Can't remember what it's called -- named
expression, maybe?
I think I use local names in Python about as much as I did in SML.
/Jorgen
--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.se> R'lyeh wgah'nagl fhtagn!
More information about the Python-list
mailing list