On Sun, Nov 6, 2016 at 5:32 PM, Nathaniel Smith <n...@pobox.com> wrote:
> > If we're considering options along these lines, then I think the local > optimum is actually a "quoted-call" operator, rather than a quote > operator. So something like (borrowing Rust's "!"): > > eval_else!(foo.bar, some_func()) > > being sugar for > > eval_else.__macrocall__(<unevaluated thunk of foo.bar>, > <unevaluated thunk of some_func()>) > > You can trivially use this to recover a classic quote operator if you > really want one: > > def quote!(arg): > return arg > Xonsh does it: http://xon.sh/tutorial_macros.html At least for "function" call, and make use of Python type annotations to decide whether to expand the expression or not, or passing, string, Ast, to the defined macro. I haven't tried it in a while but there were some ideas floating around for context-manager as well, to get the block they wrap. -- M _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/