labscript-suite-temp-2 / labscript_utils

Shared modules used by the labscript suite. Includes a graphical exception handler, debug tools, configuration management, cross platform filepath conversions, unit conversions and custom GUI widgets.
Other
0 stars 0 forks source link

Unitconversions base class should use different style of dynamic method creation #6

Open philipstarkey opened 10 years ago

philipstarkey commented 10 years ago

Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


exec'ing def statements is a bit magical, and hard for exception code and code analysis tools (and humans too!) to tell what's going on if anything goes wrong. Since Python provides the tools to create methods dynamically by other means, these should be used instead.

Oooh, maybe this will be excuse enough to write a metaclass, but probably not so I won't get my hopes up. I mean they're pretty magical too, so should be avoided without a good reason.