On Thu, Jun 10, 2021 at 2:58 PM Ricky Teachey <ri...@teachey.org> wrote:

> Something I don't understand is whether there is anything about this
> proposed feature that can't be accomplished with a simple function...
>



> ....
> And use it like this:
>
>  >>>  templify("Here, have some {foo}.")
>  TemplateLiteral(template = " Here, have some {foo}.", tokens = (("Here,
> have some ", True), ("spam & eggs", False)))
>
>
> What is it about this task that requires it being handled at the language
> level...?
>

 AIUI, that is hard to do without language support, because the function
templify can't easily access the value of 'foo' because the binding only
exists in the caller's scope.

So for a simple function to be used, you'd have to pass in the placeholder
values explicitly as separate arguments, which somewhat defeats the point.

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VGZKVTAY5CY5KNZCKY7FP2CPJX4N3NIU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to