On Fri, Oct 2, 2009 at 6:29 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: > Has anyone considered the idea of having the string % operator > behave intelligently according to the contents of the format > string? > > If it contains one or more valid %-formats, use old-style > formatting; if it contains one or more valid {}-formats, > use new-style formatting. > > Ambiguous cases could arise, of course, but hopefully they > will be fairly rare, and raising an exception would point > out the problem and allow it to be fixed. Hm... The % operator already does too much guessing: if the string contains exactly one %-format, the argument may be either a size-1 tuple or a non-tuple, otherwise it has to be a size-N tuple, except if the %-formats use the %(name)X form, then the argument must always be a dict. It doesn't sound to me as if adding more guesswork is going to improve its reliability. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
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