wxPython and macros (was: Why don't people like lisp?

mike420 at ziplip.com mike420 at ziplip.com
Sun Oct 26 12:58:02 EST 2003


Tayss wrote:

> 
> app   = wxPySimpleApp()
> frame = MainWindow(None, -1, "A window")
> frame.Show(True)
> app.MainLoop()
> 

Why do you need a macro for that? Why don't you just write

def start_window(name) :
    app = wxPySimpleApp()
    frame = MainWindow(None, -1, name)
    frame.Show(True)
    app.MainLoop()
    return (app, frame)

Macros are used for other things! 

With this function, you can do

app, frame = start_window("a window")
app.do_stuff()
frame.do_whatever()

With a "macro" (if Python had them), you could define
with_open_window(name), and do

with_open_window("a window")
   app.do_stuff()
   frame.do_whatever()

Conclusion: you don't need macros here.
Moral: maybe you do not *deserve* macros.




More information about the Python-list mailing list