Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string.Template not flexible enough to subclass (regexes) #41966

Closed
ianbicking mannequin opened this issue May 9, 2005 · 7 comments
Closed

string.Template not flexible enough to subclass (regexes) #41966

ianbicking mannequin opened this issue May 9, 2005 · 7 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ianbicking
Copy link
Mannequin

ianbicking mannequin commented May 9, 2005

BPO 1198569
Nosy @warsaw, @devdanzin
PRs
  • bpo-1198569: Allow string.Template braced pattern to be different #3288
  • What's New for bpo-1198569 #3303
  • 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 = <Date 2017-09-04.20:33:00.449>
    created_at = <Date 2005-05-09.20:55:25.000>
    labels = ['3.7', 'type-feature', 'library']
    title = 'string.Template not flexible enough to subclass (regexes)'
    updated_at = <Date 2017-09-04.21:29:28.993>
    user = 'https://bugs.python.org/ianbicking'

    bugs.python.org fields:

    activity = <Date 2017-09-04.21:29:28.993>
    actor = 'barry'
    assignee = 'barry'
    closed = True
    closed_date = <Date 2017-09-04.20:33:00.449>
    closer = 'barry'
    components = ['Library (Lib)']
    creation = <Date 2005-05-09.20:55:25.000>
    creator = 'ianbicking'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 1198569
    keywords = []
    message_count = 7.0
    messages = ['54520', '82198', '202569', '301226', '301249', '301256', '301267']
    nosy_count = 3.0
    nosy_names = ['barry', 'ianbicking', 'ajaksu2']
    pr_nums = ['3288', '3303']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1198569'
    versions = ['Python 3.7']

    @ianbicking
    Copy link
    Mannequin Author

    ianbicking mannequin commented May 9, 2005

    The regular expressions in string.Template can be
    overidden, but there's not an easy way to override the
    expression for variables inside braces and to a
    different expression than variables not in braces.
    E.g., you might allow full expressions in braces
    (including arbitrary punctuation), but only normal
    variable names outside. An example of using this kind
    of technique:

    http://svn.colorstudy.com/home/ianb/recipes/sub_expr.py

    So, in summary, idpattern should be split into two,
    idpattern and bracepattern. (Maybe a default of None
    for bracepattern, and use idpattern if bracepattern is
    None -- this would be backward compatible so that
    overriding only idpattern will effect both)

    @ianbicking ianbicking mannequin assigned warsaw May 9, 2005
    @ianbicking ianbicking mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 9, 2005
    @devdanzin
    Copy link
    Mannequin

    devdanzin mannequin commented Feb 16, 2009

    IIUC, Ian's link has a doctest for this feature.

    @warsaw
    Copy link
    Member

    warsaw commented Nov 10, 2013

    This seems like a reasonable request. Do you care to submit a patch with tests and doc updates?

    @warsaw
    Copy link
    Member

    warsaw commented Sep 4, 2017

    Sorry for the long delay. It looks like Ian's original link is no longer valid. Do you have an updated link to a possible doctest or example?

    @warsaw warsaw added the 3.7 (EOL) end of life label Sep 4, 2017
    @warsaw
    Copy link
    Member

    warsaw commented Sep 4, 2017

    Never mind; I crafted a decent test for the PR.

    @warsaw
    Copy link
    Member

    warsaw commented Sep 4, 2017

    New changeset ba42796 by Barry Warsaw in branch 'master':
    bpo-1198569: Allow string.Template braced pattern to be different (bpo-3288)
    ba42796

    @warsaw warsaw closed this as completed Sep 4, 2017
    @warsaw
    Copy link
    Member

    warsaw commented Sep 4, 2017

    New changeset 973b901 by Barry Warsaw in branch 'master':
    What's New for bpo-1198569 (bpo-3303)
    973b901

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant