On Fri, Oct 2, 2009 at 6:29 PM, Greg Ewing <greg.ew...@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/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com