string.Template.delimiter cannot be overriden?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jun 24 05:23:57 EDT 2008


En Tue, 17 Jun 2008 02:20:23 -0300, Raymond Hettinger <python at rcn.com>  
escribió:
> On Jun 16, 9:53 pm, kretik <kre... at yahoo.com> wrote:

>> I've been trying to coax this class to use something other than the
>> default '$' but it seems setting it to something else has no discernible
>> effect. Is it necessary to inherit from the class to do this?
>
> Yes, subclassing is the intended way to produce variants of Template
> with a different delimiter.

Just out of curiosity, why was it done that way?
I'd say the "obvious" way to change the default delimiter would be to set  
an instance attribute - so I guess this was a deliberate decision, but I  
can't figure out why it is better this way...

-- 
Gabriel Genellina




More information about the Python-list mailing list