[Python-Dev] transitioning from % to {} formatting
Barry Warsaw
barry at python.org
Thu Oct 1 14:21:56 CEST 2009
On Oct 1, 2009, at 2:51 AM, Vinay Sajip wrote:
> You're already covered if you use the PercentMessage/BraceMessage
> approach I
> mentioned elsewhere in this thread. Suppose:
>
> #Just typing this in, it's not tested or anything
> class DollarMessage:
> def __init__(self, fmt, *args, **kwargs):
> self.fmt = fmt
> self.args = args
> self.kwargs = kwargs
>
> def __str__(self):
> return string.Template(self.fmt).substitute(*args, **kwargs)
Right, thanks. This is a very cool feature that I didn't know logging
supported!
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 832 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-dev/attachments/20091001/90caaca9/attachment.pgp>
More information about the Python-Dev
mailing list