Vinay Sajip <vinay_sajip <at> yahoo.co.uk> writes: > #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) > Whoops, sorry, pressed the "post" button by accident on my previous post. The above substitute call should of course say string.Template(self.fmt).substitute(*self.args, **self.kwargs) and you can alias DollarMessage (or whatever name you choose) as _ or __, say. As far as the Formatter formatting goes, it's easy enough to subclass Formatter to format using whatever approach you want. Regards, Vinay Sajip
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