- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Open
Labels
Enhancement ✨Improvement to a componentImprovement to a componentMinor 💅Polishing pylint is always nicePolishing pylint is always niceNeeds decision 🔒Needs a decision before implemention or rejectionNeeds a decision before implemention or rejection
Milestone
Description
Current problem
Please see the below code:
# pylint: disable=missing-module-docstring,missing-function-docstring
from typing import NoReturn
def way_one() -> NoReturn:
    raise ValueError  # C code instantiation of ValueError
def way_two() -> NoReturn:
    raise ValueError()  # Interpreter instantiation of ValueError (slower)Check this Stack Overflow answer: https://stackoverflow.com/a/16709222
way_one is faster than way_two, when not specifying arguments to the Exception class.
Desired solution
I think it would be cool if pylint would suggest this minor optimization, when no arguments are specified.
Something like consider-raising-with-class:
> pylint a.py
a.py:9: W1234: Consider raising with exception class if no message (consider-raising-with-class)Additional context
No response
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentMinor 💅Polishing pylint is always nicePolishing pylint is always niceNeeds decision 🔒Needs a decision before implemention or rejectionNeeds a decision before implemention or rejection