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

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

[Python-Dev] transitioning from % to {} formatting [Python-Dev] transitioning from % to {} formattingJames Y Knight foom at fuhm.net
Thu Oct 1 18:15:15 CEST 2009
On Sep 30, 2009, at 1:01 PM, Antoine Pitrou wrote:
> Why not allow logging.Formatter to take a callable, which would in  
> turn call the
> callable with keyword arguments?
>
> Therefore, you could write:
>   logging.Formatter("{asctime} - {name} - {level} - {msg}".format)
>
> and then:
>   logging.critical(name="Python", msg="Buildbots are down")
>
> All this without having to learn about a separate "compatibility  
> wrapper object".

It's a nice idea -- but I think it's better for the wrapper (whatever  
form it takes) to support __mod__ so that logging.Formatter (and  
everything else) doesn't need to be modified to be able to know about  
how to use both callables and "%"ables.

Is it possible for a C function like str.format to have other methods  
defined on its function type?

James
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