thanks4opensource / buck50

STM32F103 logic analyzer and more
GNU General Public License v3.0
565 stars 57 forks source link

Python 3.9 literal comparison fix. #5

Closed JDuchniewicz closed 3 years ago

JDuchniewicz commented 3 years ago

Tiny fix, eliminates literal comparison warnings on python 3.9. Although I believe it reads much better with the keywords. Leaving them as they are will generate just two warnings on startup so whatever the maintainer decides is better 😄

thanks4opensource commented 3 years ago

Thanks @JDuchniewicz for catching this and providing the fix. I hadn't seen the problem because I'm stuck back on an earlier Python3 version. As much as I agree with you on the readability issue, this isn't COBOL ;) and to my understanding the 3.8+ warning is justified -- although most implementations will always have small/common constants as unique singleton objects, the language doesn't guarantee it. Sloppy coding on my part, although in my defense I've been working with Python XML a lot recently, where implicitly treating objects as booleans doesn't work and explicit if some_object is not None: instead of if not some_object: is required. I guess the habit carried over. ;)

I manually merged your patch along with an update for a different problem I'd discovered, and pushed up buck50.py 0.9.5. Thanks again, and please feel free to file issues and/or pull requests for anything else you find.