<div dir="ltr">Responding to comments off list:<div><br></div><div>I'm not referring to C-style preprocessor macros, I'm referring to macros historically found in functional languages and commonly found in many user-targeted languages built in the last few years.</div><div><br></div><div>The goal is to create things that look like functions but have access to the expression that was passed in.  </div><div><br></div><div>Some examples where this is useful:</div><div><br></div><div><font face="monospace, monospace">    plot(year, miles / gallon)  # Plot with labels determined by input-expressions, e.g. miles/gallon</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    assertRaises(ZeroDivisionError, 1/0)  # Evaluate the rhs 1/0 within assertRaises function, not before</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    run_concurrently(f(x), f(y), f(z))  # Run f three times in three threads controlled by run_concurrently</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Generally one constructs something that looks like a function but, rather than receiving a pre-evaluated input, receives a syntax tree along with the associated context.  This allows that function-like-thing to manipulate the expression and to control the context in which the evaluation occurs.  </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">There are lots of arguments against this, mostly focused around potential misuse.  I'm looking for history of such arguments and for a general "Yes, this is theoretically possible" or "Not a chance in hell" from the community.  Both are fine.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Cheers,</font></div><div><font face="arial, helvetica, sans-serif">Matthew</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 27, 2015 at 4:24 PM, Luciano Ramalho <span dir="ltr"><<a href="mailto:luciano@ramalho.org" target="_blank">luciano@ramalho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Mar 27, 2015 at 8:19 PM, Matthew Rocklin <<a href="mailto:mrocklin@gmail.com">mrocklin@gmail.com</a>> wrote:<br>
> I want Python to have macros.  This is obviously a hard sell.  I'm willing<br>
> to do some legwork to demonstrate value.<br>
<br>
</span>You're probably aware of this "prior art", but anyway, it's worth a<br>
link. Looks solid to me:<br>
<br>
<a href="https://github.com/lihaoyi/macropy" target="_blank">https://github.com/lihaoyi/macropy</a><br>
<br>
Cheers,<br>
<br>
Luciano<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Luciano Ramalho<br>
|  Author of Fluent Python (O'Reilly, 2015)<br>
|     <a href="http://shop.oreilly.com/product/0636920032519.do" target="_blank">http://shop.oreilly.com/product/0636920032519.do</a><br>
|  Professor em: <a href="http://python.pro.br" target="_blank">http://python.pro.br</a><br>
|  Twitter: @ramalhoorg<br>
</font></span></blockquote></div><br></div>