> [Raymond Hettinger] > > However, I think we should follow Cheetah's example. > > Sorry, I never heard of Cheetah before you mentioned it (& still don't > know what it is), so feel no pressure to ape it. I'm surprised that we're introducing a new API into the standard library and no one is showing the slightest interest in prior art. Cheetah is well thought out, fast, and mature (it's been through several evolutions in the wild). Also, the Cheetah designers started out by studying the existing art from ASP, JSP, PHP, PSP, and such. Templating and string substituion is not a new, yet the discussion here has the flavor of being thought up from scratch. > > That's makes it less of a pita when the template naturally contains > > dollar signs with numbers: > > I don't care. The minority of Americans who want to use $ in a > minority of templated strings in a minority of apps can learn to type > $$, or use the ironically named SafeTemplate instead (as suggested > earlier). > > > Template("Dear ${donor}, send $100.00 to the PSF template fund.") > > Which would trigger an exception, after which they type one character > to repair it: > > Template("Dear ${donor}, send $$100.00 to the PSF template fund.") FWIW, I'm fine with that. It was a minor suggestion. Either way works. My thought was that simpler string substitutions were going to be exposed to the end-user (non-programmers) and that they should not be harassed unnecessarily. However, these are easy errors to trap and report back to the user -- the only question being how to assign a line number to the exception (if I have a ten page user supplied template with an error, it would be great to tell them where it is). Raymond > > They'll live, but not at everyone else's expense. They're already > confused, or they wouldn't have bothered with the unnecessary braces > around "donor" <wink>.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4