A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021529.html below:

[Python-Dev] A Hygienic Macro System in Python?

[Python-Dev] A Hygienic Macro System in Python?James_Althoff@i2.com James_Althoff@i2.com
Wed, 20 Mar 2002 17:47:15 -0800
Or ...

invoke callable():
    statement1
    statement2
    . . .
    statementn


is syntax for:


def temp():
    statement1
    statement2
    . . .
    statementn

callable(temp)

del temp


More generally,

invoke expr-that-results-in-a-callable(a,b,c) lambda x,y,z:
    statement1
    statement2
    . . .
    statementn

is syntax for:

def temp(x,y,z):
    statement1
    statement2
    . . .
    statementn

expr-that-results-in-a-callable(temp,a,b,c)

del temp


examples:

invoke aquireLockAndDo():
    sensitiveStuff()

invoke withConnectionDo():
    generateReport()

invoke gui.showBusyCursorDuring():
    doQuery()

invoke gui.showStatusDuring(msg="Searching..."):
    doQuery()

invoke gui.showBusyCursorDuring():
    invoke gui.showStatusDuring(msg="Generating Report..."):
        invoke withConnectionDo():
            generateReport()

invoke button.setEventHandler() lambda event:
    print event


Freely substitute any preferred keyword: "call", "run", etc. instead of
"invoke".

call aquireLockAndDo():
    sensitiveStuff()

run aquireLockAndDo():
    sensitiveStuff()

etc.

Doesn't handle return values, but ...

Jim




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4