A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-October/092432.html below:

[Python-Dev] transitioning from % to {} formatting

[Python-Dev] transitioning from % to {} formatting [Python-Dev] transitioning from % to {} formattingVinay Sajip vinay_sajip at yahoo.co.uk
Thu Oct 1 09:07:52 CEST 2009
Brett Cannon <brett <at> python.org> writes:

> As for the PercentMessage/BraceMessage, I would make sure that you
> just simply take the string format and simply apply the arguments
> later to cut down on the amount of parentheses butting up against each
> other: ``logger.debug(BraceMessage("The {} is {}"), "answer", 42)``.

The problem with that is that BraceMessage.__str__() wouldn't know what
arguments to use to produce the message.

> cost of wrapping all strings for a while. I suspect most people will
> simply import the wrapping class and give it some short name like
> people do with gettext.
> 

Yes,

logger.debug(__("The {} is {}", "answer", 42))

isn't ideal but perhaps liveable with. And hopefully with a decent editor, the
paren-butting annoyance will be minimized.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4