Skip to content

better name for re.error Exception class. #83162

Description

@Carreau
mannequin
BPO 38981
Nosy @gpshead, @ezio-melotti, @serhiy-storchaka, @Carreau, @Sourabh025
PRs
  • bpo-38981: Rename re.error to re.ReCompileError for better readability. #17501
  • 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 = None
    closed_at = None
    created_at = <Date 2019-12-05.16:56:07.880>
    labels = ['expert-regex', 'easy', 'type-feature', '3.9']
    title = 'better name for re.error Exception class.'
    updated_at = <Date 2020-09-18.07:39:36.123>
    user = 'https://github.com/Carreau'

    bugs.python.org fields:

    activity = <Date 2020-09-18.07:39:36.123>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Regular Expressions']
    creation = <Date 2019-12-05.16:56:07.880>
    creator = 'mbussonn'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38981
    keywords = ['patch', 'easy']
    message_count = 11.0
    messages = ['357867', '357878', '357882', '357883', '357884', '357886', '357962', '357982', '357986', '358059', '358124']
    nosy_count = 6.0
    nosy_names = ['gregory.p.smith', 'ezio.melotti', 'mrabarnett', 'serhiy.storchaka', 'mbussonn', 'sourabh025']
    pr_nums = ['17501']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue38981'
    versions = ['Python 3.9']

    Linked PRs

    Activity

    1. Carreau commented on Dec 5, 2019

      Carreaumannequin
      MannequinAuthor

      better error/exception name for re.compile error.

      Currently the error raise by re.compile when it fails to compile is error defined in sre_constants.py:

      class error(Exception):
          """Exception raised for invalid regular expressions.
      
      

      This is quite disturbing as most exception start with an uppercase and have a tiny bit more descriptive name.

      Would it be possible to have it renamed as something more explicit like ReCompileError, and still keeping the potential error alias as deprecated ?

    2. serhiy-storchaka commented on Dec 5, 2019

      @serhiy-storchaka
      Member

      It is common practice that the module specific exception is called just "error". There is nothing wrong with this.

      I do not see a need to introduce a different alias.

    3. serhiy-storchaka commented on Dec 5, 2019

      @serhiy-storchaka
      Member
    4. Carreau commented on Dec 5, 2019

      Carreaumannequin
      MannequinAuthor

      Most of the module specific classes are Error, not error, at least with an uppercase E you know it's a class.

      if a novice sees :

      error: missing ), unterminated subpattern at position 0

      It will be relatively tough or them to figure out that error is the type of the exception.

      Also it's not because something works that you can't improve it ...

    5. reopened this on Dec 5, 2019
    6. serhiy-storchaka commented on Dec 5, 2019

      @serhiy-storchaka
      Member

      Since it affects more than one module I suggest to discuss the idea about renaming exceptions of the Python-Ideas maillist first. Until different decision be made I am closing. Personally I think this is a duplicate of just discussed and rejected idea.

    7. Carreau commented on Dec 5, 2019

      Carreaumannequin
      MannequinAuthor

      Thanks for the advice I've done that !

      Have a good day.

    8. serhiy-storchaka commented on Dec 7, 2019

      @serhiy-storchaka
      Member
    9. 32 remaining items

    10. added 3 commits that reference this issue on Dec 3, 2023
    11. added a commit that references this issue on Dec 11, 2023
    12. terryjreedy commented on Dec 12, 2023

      @terryjreedy
      Member

      I merged the near-minimal PR with re.error 'updated' only in idlelib. I will do adjusted backports of the idlelib changes to keep the main bodies of its files in sync and then close.

    13. added 2 commits that reference this issue on Dec 12, 2023
    14. added a commit that references this issue on Dec 12, 2023
    15. added a commit that references this issue on Dec 12, 2023
    16. added a commit that references this issue on Feb 11, 2024
    17. added a commit that references this issue on Sep 2, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions