On Mon, 2006-04-03 at 23:43 +1000, Nick Coghlan wrote: > What do you think of a "format" builtin function that accepts the format as > the first argument (similar to printf). > > The version on my harddrive permits positional arguments via $1, $2, etc, as > well as string formatting (by sticking the format code in square brackets > between the $ and the identifier). Keyword arguments still work, naturally. > > And if you don't want formatting, you just leave out the square brackets.
I'm not totally sure I would need a builtin. If I look at the two sources of $-strings in an app like Mailman, I'll see 1) literal human readable/translatable strings in the source code, 2) human entered strings that come from a web form. In the first case, all string formatting will funnel through one bottleneck function, which will do the catalog lookup, frame variable discovery, and substitution all in one fell swoop. So there, the builtin doesn't buy you much convenience. In the second case, it's possible that it could help you a bit, but even there, I don't think a builtin would buy you much clarity or simplicity. I'm willing to believe that my uses are fairly narrow and that such a builtin could be useful for other applications, but I don't see too much of a benefit for the code I've written. -Barry
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
