[New-bugs-announce] [issue12518] In string.Template it's impossible to transform delimiter in the derived class

py.user report at bugs.python.org
Fri Jul 8 02:36:49 CEST 2011


New submission from py.user <port139 at yandex.ru>:

>>> import string
>>> class MyTemplate(string.Template):
...   delimiter = '.'
... 
>>> MyTemplate.delimiter = 'x'
>>> mt = MyTemplate('.field xfield')
>>> mt.substitute(field=None)
'None xfield'
>>> mt.delimiter
'x'
>>>


If I want to change the pattern string by any delimiter, I should create a new class for every delimiter

I would change the delimiter either in the object or in the class at any time

----------
components: Library (Lib)
messages: 140010
nosy: py.user
priority: normal
severity: normal
status: open
title: In string.Template it's impossible to transform delimiter in the derived class
type: feature request
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12518>
_______________________________________


More information about the New-bugs-announce mailing list