A = X > Y ? X : Y

Michael Hudson mwh21 at cam.ac.uk
Thu Feb 10 03:35:11 EST 2000


"Evan Simpson" <evan at 4-am.com> writes:

> Bob Alexander <bobalex at home.com> wrote in message
> news:00e401bf7332$4aea6ea0$74eb0b18 at stcla1.sfba.home.com...

> > It can't be encapsulated into something that looks like a function call
> > since Python doesn't support macros. Functions always evaluate all of
> their
> > arguments before invoking function code, so there is no way to evaluate
> only
> > one of the selected expressions.
> Sure it does.  They're called bytecodehacks :-) 

Thanks for the plug.

> Even better, they are
> *semantic* macros, and can achieve feats to which no mere syntactic macro
> could aspire.

Evan, what are you talking about here?  As far as I understand it, the
effects that can be acheived with the "semantic" bytecodehack-y macros
is a strict subset of what could be acheived with a full-blown syntax-
mutating macro facility. The main distinction of bytecodehacks' macros
is that that are inherently hygenic, i.e. you don't end up overwriting
local variables just because you happened to use that variable name in
the routine you use the macro in.  Unless I created something I really
didn't understand...

ooh-look-bricktext-ly y'rs

More information about the Python-list mailing list