[Python-Dev] defmacro (was: Anonymous blocks)

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 27 02:27:17 CEST 2005

flaig at sanctacaris.net wrote:
> Actually I was thinking of something related the other day:
 > Wouldn't it be nice to be able to define/overload not only
 > operators but also control structures?

That triggered off something in my mind that's somewhat
different from what you went on to talk about.

So far we've been talking about ways of defining new
syntax. But operator overloading isn't creating new
syntax, it's giving a new meaning to existing syntax.
So the statement equivalent of that would be defining
new meanings for *existing* control structures!

For example, when you write

   while expr:

it gets turned into



No, I'm not really serious about this -- it was just
a wild thought!

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list