On Mon, 2006-04-03 at 13:51 -0500, Ian Bicking wrote: > > No it shouldn't be. format() should be a varargs function; __rmod__ > > takes a single argument which may be a tuple. Also, format() could > > take keyword args in case the string contains named format, so I can > > write e.g. "%(foo)s".format(foo=123). > > Would "%(foo)s".format({'foo': 123}) work? Or would you need **{...}?
I do think you'd want **{}. > FWIW, I suspect I'd be much more likely to use named %'s with .format() > than with %; which is probably good, since named markers are more > flexible. Especially if .format() takes keywords as the substitution variables. > E.g., I never do: "%(path)s: path %(path)r does not exist" % > {'path': path}, but I often do "%s: path %r does not exist" % (path, > path). But the first form is really better in several ways. > > If .substitute() (or .sub()?) was available to do $-based substitution > alongside .format() for %-based substitution, that would both have a > nice symmetry and make it more comfortable to move between the two. It does feel that way. -Barry
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com