Logging messages with dictionary args in Python 2.4b1 leads to exception

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Oct 22 03:12:49 EDT 2004


Steve Holden <steve at holdenweb.com> wrote in message news:<ROXdd.8976$SW3.2862 at fed1read01>...
> But how much simpler
> 
> logging.want("%(string)s and the %(number)d dwarves",
>                  string="Snow White", number=7)
> 

logging.want? ;-)

Well, it was a trivial example. In real use cases, the dict would be a
variable rather than a literal. The problem with using kwargs is that
it could interfere with keyword arguments passed to the logging method
(currently only exc_info, but there may be others in future).

Regards,


Vinay Sajip



More information about the Python-list mailing list