intrepidcs / python_ics

Library for interfacing with Intrepid devices in Python
MIT License
61 stars 31 forks source link

use Enum best practices #106

Closed ethanfurman closed 1 year ago

ethanfurman commented 3 years ago

is instead of ==

None for unknown/null/not present value

use member attributes to avoid if/elif chains

actual values instead of auto for interfacing with external libraries

drebbe-intrepid commented 2 years ago

This PR breaks generation and doesn't really add any value so closing for now.

ethanfurman commented 2 years ago

This PR breaks generation

Could you be more specific? Perhaps I can address that issue as well.

drebbe-intrepid commented 2 years ago

Unfortunately I don't remember anymore; All of the files under ics/* should remain the same though. This script either broke that or just raised an exception and never finished. From my memory it looked like the enum classes used in the python source were confused with the parsed c enums from the actual header file (I'm not a fan code parsing source code anymore, lol).

I've also run into issues using is instead of == in very rare corner cases so I stray away from using that now. Had to do with passing objects around with c modules and how references to objects are "invisible" in python.