On Mon, Apr 2, 2012 at 6:26 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 02 Apr 2012 00:39:42 -0700, Yingjie Lan wrote: >> The compiler can choose to convert it into a string >> formatting expression, of course. To efficiently formatĀ strings at >> runtime, the best choice (especially >> for safty reasons) is string formatting, not evaluating a dynamic >> string. > > So you're suggesting that we should have dynamic strings, but not > actually use dynamic strings. The compiler should just convert them to > regular string formatting. > > Why not cut out the middle-man and just use regular string formatting?
Actually, this sounds like a job for a precompiler/preprocessor. Do whatever translations you want on your code, then turn it into a .py file for execution. But hardly necessary, as there are already two - err, three, I stand corrected - perfectly good ways to do it. ChrisA -- http://mail.python.org/mailman/listinfo/python-list