[Python-Dev] Re: Re: Re: Update PEP 292
Fernando Perez
fperez528 at yahoo.com
Fri Aug 20 22:57:12 CEST 2004
Note: I'm resending this, b/c I'd like to see this particular suggestion
addressed as things seem to be finalizing on this PEP. My original message
seems to have fallen below the radar, and I think it's a reasonable idea (or
at least I would like to hear why it isn't :)
Best to all,
f
------ my original post:
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
More information about the Python-Dev
mailing list