This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ross Biro
Recipients Ross Biro, eric.smith, lisroach
Date 2019-03-12.13:50:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAKL-1-9pN3dXZYdwLLVOqjVmOFP-TaFX+XebdSVsoJ8Ls807ag@mail.gmail.com>
In-reply-to <1552362429.54.0.698121299616.issue36159@roundup.psfhosted.org>
Content
I'm currently writing a language translator between two domain specific
computer languages.  Because some expressions occur repeatedly, but in
slightly different contexts, I make multiple passes.  The first pass
reduces everything it can and leaves place holder objects for things it
can't reduce.  Later passes replace the objects with their final expression
in the new language.  The final expression varies by context, so every time
it's reevaluated, it could change.  I would really like to handle things
like a + b as

"{a} + {b}".format(a=a, b=b)

This works great when a and b are strings.  But when they are place holder
objects, I wasn't able to find a good solution.  Although the Formatter
class came so close that I thought I would suggest the change.  What I
ended up doing was replacing objects with unique strings so that I could
use format and then using regular expressions on the output string to split
it into an array and replace the string identifiers with the original
objects.  The change I've suggested to the Formatter class would have
allowed me to skip the regular expressions.

    Ross

On Mon, Mar 11, 2019 at 11:47 PM Lisa Roach <report@bugs.python.org> wrote:

>
> Lisa Roach <lisaroach14@gmail.com> added the comment:
>
> Can you give an example use case for this? F-strings are the newer method
> of string interpolation, I'm not sure it's worth putting effort into adding
> features to string.Formatter.
>
> ----------
> nosy: +lisroach
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue36159>
> _______________________________________
>

-- 
*Ross Biro* | CTO
_______________________________________

O: 240-380-2231|  F: 240-556-0361 <(240)%20556-0361>
The Interface Financial Group <https://interfacefinancial.com/>

CONFIDENTIALITY NOTICE: This email message, including any attachments, is
for the sole use of the intended recipient/s and may contain confidential &
privileged information. Any unauthorized review, use, disclosure, or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original
messages and any attachments.
History
Date User Action Args
2019-03-12 13:50:01Ross Birosetrecipients: + Ross Biro, eric.smith, lisroach
2019-03-12 13:50:01Ross Birolinkissue36159 messages
2019-03-12 13:50:01Ross Birocreate