Hi Matthias,
On 15/09/2020 11:25 pm, Matthias Bussonnier wrote:
Mark,
Thanks you this is an interesting proposal. I can see how many of the "magics"
provided by IPython/Jupyter could also be replaced by some of those macros.
A couple of questions – which I understand could be delegated to further
improvement to macros in a subsequent proposal.
- I'm not sure I see how these macros could take parameters ? For example
`timeit` in IPython takes a number of options on the number of repetitions and
the number of innerloop for really fast code. I'm not sure how this would be
done with your proposal, would
stmt_macro!(options):
multi_statement_body
Be something you consider for a later iteration? I might be missing how to do
it, apologies about this if its the case.
passing parameters also likely apply to siblings macros?
Macros already take arguments.
timeit! 10000:
body
is legal syntax.
It is up to the timeit macro how to parse the arguments.
Alternatively you could use an inner macro:
timeit!:
repetitions! 10000
body
- especially for statement_macros, have you considered to relax the syntax
inside the block, and pass the string of the dedented block to the macross
processor (or have it as an option). That would make it quite easier to embed
non-python syntax, and allow to convert a much larger chunk of the
IPython/Jupyter magics to macros.
I'm not sure that further relaxing the syntax would be acceptable. The
term "a nightmarish hodge-podge of different dialects" has already been
used :)
Cheers,
Mark.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/ALUNO4F4OFFRGNSCTYKT7AOZGSFPAE67/
Code of Conduct: http://python.org/psf/codeofconduct/