On Mon, Nov 23, 2020, 4:32 PM Eric V. Smith

> I just commented on Steve's post over on Discourse. The problem with this
> is that the called function (m.case, here) needs to have access to the
> caller's namespace in order to resolve the expressions, such as StringNode
> and PairNone. This is one of the reasons f-strings weren't implemented as a
> function, and is also the source of many headaches with string type
> annotations.
>
Is this really true though? Yes, it would require magic of the sort
zero-argument `super()` does. But can't the Matcher constructor capture the
locals one step up the stack on instance creation? That's largely why my
strawman version is slightly different from Steve's strawman.

I'd put the question this way: assuming Matcher can be written (with a bit
of stack magic), and assuming that the strings inside m.case() calls are
exactly the same mini-languague PEP 634 proposes, would you want a syntax
change?

That's not rhetorical, I'm of mixed feeling myself.
_______________________________________________
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/ZQBAYYR5KJFJVXVYQQ3TIS5JLJZDM3K3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to