PyCQA / flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
MIT License
1.06k stars 104 forks source link

New check finding usage of __debug__ #376

Closed kasium closed 1 year ago

kasium commented 1 year ago

Python has a weird built-in variable called __debug__ which is true when not running in optimized mode. I guess there is only a limited number of packages using optimized mode, therefore using __debug__ spoils the code.

What do you think about a simple check finding __debug__ ? I'm happy to contribute it 😄

JelleZijlstra commented 1 year ago

The purpose of this linter is to highlight code that is likely to indicate bugs. How would this proposed check help with that purpose? I'd assume people who use __debug__ generally know what they're doing.