what's in a name (was Re: using lambda to print everything in a list)

Roman Suzi rnd at onego.ru
Mon Apr 30 06:33:32 EDT 2001


On Mon, 30 Apr 2001, Alex Martelli wrote:

>You COULD say "the same thing", but that would not be "the
>language capabilities don't change"; what I was specifically
>saying is that naming "a code fragment" (to be passed as an
>argument to some other function), rather than leaving it
>unnamed, seems to me to result in clearer code.  So, "the
>same thing", if said of subexpression-values, would be that
>the naming seemed to result in clearer code.

Clearer code will be the result of good commenting.
You can add whatever lengthy comment and explain
everything there without too much burden on the CPU.
Calling  half a dozen functions + resolving names
in a deeply nested loop is very inefficient.

Probably we should ask Guido for the construction like:

exec:
  res = e**(pi*x+y)
where:
  x = lenthy_function()
  y = even_larger_function()
  pi = math.pi
  e = math.e

to has no impact on the outside name space
by unnaming x, pi, e during byte-compilation.

Looks nice. Who is going to write a PEP? ;-)


Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Monday, April 30, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Do fish get thirsty?" _/





More information about the Python-list mailing list