On Fri, 15 Dec 2006 17:21:12 +0100
André Thieme <[EMAIL PROTECTED]> 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
( [EMAIL PROTECTED] )
Real programmers can write assembly code in any language.
--
http://mail.python.org/mailman/listinfo/python-list