merits of Lisp vs Python
Slawomir Nowaczyk
slawomir.nowaczyk.847 at student.lu.se
Fri Dec 15 17:38:57 EST 2006
On Fri, 15 Dec 2006 17:21:12 +0100
André Thieme <address.good.until.2006.dec.22 at justmail.de> wrote:
#> And we might go further (again with an easy Graham example).
#> See this typical pattern:
#>
#> result = timeConsumingCalculation()
#> if result:
#> use(result)
#>
#> We need this ugly temporary variable result to refer to it.
#> If we could use the anaphor[1] "it" that could make situations like
#> these more clean.
#>
#> Imagine Python would have an "anaphoric if", "aif". Then:
#>
#> aif timeConsumingCalculation():
#> use(it)
I would spell the above like this:
def timeConsumingCalculation():
pass
def useit(it):
pass
def aif(first,second):
res = first()
if res:
second(res)
aif(timeConsumingCalculation,useit)
Sure, it requires me to define function useit instead of embedding the
code in aif call, but that has never been a problem for me: in reality,
the code I would want to execute would be complex enough to warrant it's
own function anyway. Of course, YMMV.
--
Best wishes,
Slawomir Nowaczyk
( Slawomir.Nowaczyk at cs.lth.se )
Real programmers can write assembly code in any language.
More information about the Python-list
mailing list