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/092525.html below:

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

[Python-Dev] transitioning from % to {} formatting [Python-Dev] transitioning from % to {} formattingPaul Moore p.f.moore at gmail.com
Fri Oct 2 15:20:28 CEST 2009
2009/10/1 Eric Smith <eric at trueblade.com>:
> It's tangential, but in the str.format case you don't want to check for just
> '{asctime}', because you might want '{asctime:%Y-%m-%d}', for example.
>
> But there are ways to delay computing the time until you're sure it's
> actually being used in the format string, without parsing the format string.
> Now that I think of it, the same technique could be used with %-formatting:

Still tangential, but it seems to me that this discussion has exposed
a couple of areas where the logging interface is less than ideal:

- The introspection of the format string to delay computing certain
items (Eric's suggestion may be an improvement here).
- The "call str() on any non-string object to get a format string" API
(which precludes string subclasses).

I suspect other APIs will exist with similar issues once the whole
question of supporting multiple format syntaxes gets wider
publicity...

Paul.
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