[Python-Dev] Re: Re: Re: Update PEP 292 (original) (raw)

Fernando Perez fperez528 at yahoo.com
Wed Aug 18 20:07:59 CEST 2004


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: fooandthisisfoo.bar:foo and this is foo.bar: fooandthisisfoo.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:

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



More information about the Python-Dev mailing list