On Sep 29, 2009, at 11:15 PM, Martin v. Löwis wrote: > I would propose that the format argument gets an argument name, > according to the syntax it is written in. For PEP 3101 format, > I would call the argument "format" (like the method name of the > string type), i.e. > > logging.Formatter( > format="{asctime} - {name} - {levelname} - {message}") > > For the % formatting, I suggest "dicttemplate" (assuming that > you *have* to use dictionary %(key)s style currently). > > The positional parameter would also mean dicttemplate, and > would be deprecated (eventually requiring a keyword-only > parameter). Although I hate the name 'dicttemplate', this seems like the best solution to me. Maybe it's good that 'dicttemplate' is so ugly though so that people will naturally prefer 'format' :). But I like this because there's not really any magic, it's explicit, and the decision is made by the coder at the call site. The implementation does not need to guess at all. If this is adopted, it should become a common idiom across Python so that once you've learned how to transition between the format strings, you pretty much know how to do it for any supporting API. So we should adopt it across all of the standard library. -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/20090930/115766a2/attachment-0001.pgp>
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