---------------------------------------- > To: python-list@python.org > From: tjre...@udel.edu [...] >> It's a conflict in the design. A tuple is used to supply multiple >> arguments to the % operator. So if you want to have a tuple as the >> first argument, you need to enclose it in another tuple. > > The problem is that interpolating 1 to many items into a string is *not* > a binary operation. The needed hack to pretend that it is, using a tuple > to represent multiple items rather than just itself, was one of the > reasons for making string formatting a honest function, where multiple > items to be formatted are passed as multiple arguments.
Thanks so much guys! Now I understand why some people hate %-formatting! I don't think that's a problem because there's no format specifier for tuples in the %-formatting definition[1]. So it's up to the user to make the necessary conversion. I still love the %-formatting style! Can str.format() do the following? f = '%d %d %d' v = '1,2,3' print f % eval(v) If yes, how? [1] http://docs.python.org/2/library/stdtypes.html#string-formatting -- http://mail.python.org/mailman/listinfo/python-list