You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In string.Template it's impossible to transform delimiter in the derived class #56727
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/warsaw'closed_at=<Date2017-03-28.14:04:00.346>created_at=<Date2011-07-08.00:36:49.067>labels= ['type-feature', '3.7', 'docs']
title="In string.Template it's impossible to transform delimiter in the derived class"updated_at=<Date2017-03-28.14:04:00.345>user='https://github.com/py-user'
You are correct that this is a feature request as written. I think there is also a doc bug (the docs should probably mention that changing delimiter after class creation is a no-op).
To add this feature the computation of the regex would need to be moved from the metaclass init to the object init. The question is, was doing this in a metaclass a design decision (perhaps a micro-optimization?), or a "cute trick" that turns out to cause unintuitive consequences? I think Barry was involved in adding the Template feature, so I'm adding him as nosy (I don't have a clone handy to check hg annotate).
I don't know that anybody relies on the current behavior and computers are now a bazillion times faster than they were in 2004, so who needs that micro optimization any more?
As this issue has been open for a long time, and I don't think it's worth changing the implementation, I am changing this to a documentation bug and will fix it along with the rewrites for bpo-19824 and bpo-20314
Activity
py-user commentedon Jul 8, 2011
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
SilentGhost commentedon Jul 8, 2011
3.1 is in security fixes-only mode
bitdancer commentedon Jul 9, 2011
You are correct that this is a feature request as written. I think there is also a doc bug (the docs should probably mention that changing delimiter after class creation is a no-op).
To add this feature the computation of the regex would need to be moved from the metaclass init to the object init. The question is, was doing this in a metaclass a design decision (perhaps a micro-optimization?), or a "cute trick" that turns out to cause unintuitive consequences? I think Barry was involved in adding the Template feature, so I'm adding him as nosy (I don't have a clone handy to check hg annotate).
merwok commentedon Jul 11, 2011
See 629200d880ea for answers.
warsaw commentedon Jul 11, 2011
I don't know that anybody relies on the current behavior and computers are now a bazillion times faster than they were in 2004, so who needs that micro optimization any more?
warsaw commentedon Mar 28, 2017
As this issue has been open for a long time, and I don't think it's worth changing the implementation, I am changing this to a documentation bug and will fix it along with the rewrites for bpo-19824 and bpo-20314
warsaw commentedon Mar 28, 2017
New changeset 9f74deb by Barry Warsaw in branch 'master':
Improve the documentation for template strings (#856)
9f74deb