Barry Warsaw wrote: > On Sat, 2004-09-11 at 09:04, Erik Heneryd wrote: > > >>Come to think of it, I really like the more OO-ish approach better, than >>to cram everything into a single class. Is the safe_substitute really >>that special it deserves a special method? > > > Yes. > > >> Is it really the one, true >>way to do a "safe" substitution? > > > Probably not. > > >>IIRC DOS and sh don't agree, so it's >>not that obvious. > > > I'm sorry I don't follow that one. DOS: '%NOTFOUND%' => '%NOTFOUND%' sh: '$NOTFOUND' => '' BTW, what about a closing delimiter in the standard regex? >>I say keep the inheritance thing, it's much more flexible, and delegate >>the KeyError condition to an overridable method. > > > After the lengthy discussions on python-dev, I'm viewing the role of the > Template class a little differently, so I think it's fine to put them > both in one class. I think there are more use cases for a KeyError hook than just sh-style substitution; a default value, a computed value (think replacing html entities - returning chr(idpattern) on KeyError) etc... I hope you don't do pep-292 just to fill your own needs (i18n?), but also keep your mind open to other uses... Erik
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