Barry Warsaw wrote: > On Wed, 2004-08-11 at 10:54, Fernando Perez wrote: >> It may be trivial to extend pep-292 for this, but not having to do it in >> every >> small utility you write/ship would be very useful, IMHO. If there are no >> technical reasons to prevent it, is the 'too complex' argument really that >> strong (especially since you state it's a trivial amount of code)? > > Well, it's about 3 lines of Python, but what would you call the class, > AttributeTemplate? I wouldn't be opposed to adding the class, since I > think it would be pretty useful. I'd like to argue that this form may be the most useful for common tasks, so you can mix and match "this is foo: $foo and this is foo.bar: $foo.bar" without having to worry too much about which template class you are using. How about making a BaseTemplate class which does NOT allow $foo.bar, and having the default Template implement attributes? This would give us: - A default class covering what I think is a reasonable, common-case behavior. I'm a big fan of covering most _reasonable_ default behavior out-of-the-box, and I think python's stdlib achieves this very well in most cases. I'd argue this is one of the reasons for its success, and I have the feeling that in this case (PEP-292) the proposed default would be sub-par. - A clean base class for user-defined subclasses which want to be very exacting about what they want to implement or not. This sounds like a reasonable compromise to me, but ymmv. Best, and thanks for keeping an open mind about this issue (string interpolation is one of the very few areas where python's syntax bugs me, even after years of daily use). f
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