No macros in Python
Bengt Richter
bokr at oz.net
Mon Dec 16 23:57:56 EST 2002
More information about the Python-list mailing list
Mon Dec 16 23:57:56 EST 2002
- Previous message (by thread): No macros in Python
- Next message (by thread): No macros in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 15 Dec 2002 20:37:47 -0500, Carl Banks <imbosol at vt.edu> wrote: >Lulu of the Lotus-Eaters wrote: >> But in general I would challenge >> Cherniavsky, or anyone else, to present a case where anything could be >> done significantly more easily in Python if macros were added. I really >> do not think there are any such situations. > >Here is the macro I've most often wished I had (in other languages, >not Python): > >defmacro call_but_return_if_false(function,*args,**kwargs): > result = function(*args,**kwargs) > if not result: > return > Funny, I just posted something (in this thread) that implements alternate returns on a control stack, where the callee makes the choice as to where to continue after the return, but on the basis of specified alternatives. Example code included, called spaghetti.py ;-) >The return statement would return from the function this macro is >expanded in, of course. I don't need it in Python because exceptions >are a much better method here. God knows the Python source code could >use it. > Hm. Prime example? Regards, Bengt Richter
- Previous message (by thread): No macros in Python
- Next message (by thread): No macros in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list