python3: 'where' keyword

Paul Rubin http
Tue Jan 11 02:56:43 EST 2005


Steve Holden <steve at holdenweb.com> writes:
> Well I for one disagreed with many of your estimates of the zen's
> applicability to macros, but I just couldn't be arsed saying so.

Well, I was being somewhat flip with them, as I felt Carl was being
snotty in referring me to the Zen list.  The point there is that one
can interpret each of the Zen points in many ways regarding macros.  I
don't feel there's a conflict between macros and the Zen list.  Macros
in Python are a deep subject and gurus have been discussing them for a
long time.  I think that with PyPy it will become easier to experiment
with possible approaches.  In other posts I've suggested a moratorium
on new Python syntax until after PyPy is deployed.

> > An amazing amount of the headaches that both newbies and experienced
> > users have with Python, could be solved by macros.... It's not clear
> > what the best way to do design them is, but their existence can have a
> > profound effect on how best to do these ad-hoc syntax extensions like
> > "where".  
> This is not a justifiable assertion, IMHO, and if you think that
> newbies will have their lives made easier by the addition of ad hoc
> syntax extensions then you and I come from a different world (and I
> suspect the walls might be considerably harder in mine than in yours).

I'm saying that many proposals for ad hoc extensions could instead be
taken care of with macros.  Newbies come to clpy all the time asking
how to do assignment expressions, or conditional expressions, or
call-by-reference.  Sometimes new syntax results.  Lots of times,
macros could take care of it.

> I don't really understand why, if macros are so great (and you are
> reading the words of one who was using macros back in the days of
> Strachey's GPM) why somebody doesn't produce a really useful set of
> (say) M4 macros to prove how much they'd improve Python.

You can't really do Python macros with something like M4.  How would
M4 even generate multi-line output that's indented to the right depth
for the place where the macro was called?  How would you write an
m4 macro like cond(x,y,z) that does the equivalent of (x ? y : z)?
Even if you could, it doesn't begin to address the hassle of running
Python scripts through m4 before you can execute the scripts, especially
in an interactive environment.



More information about the Python-list mailing list