-
Notifications
You must be signed in to change notification settings - Fork 292
Description
From a comment in #620:
There are lots of magic string constants like "mw". imho, most of these should be defined as constants. I tend to create a class (e.g., > Constants) and define class variables with same/similar names, so:
param_dict = {"mw": base_units["mass"]/base_units["amount"]}
would becomeclass Constants:
mw = "mw" #: this is also an opportunity
mass = "mass" #: to comment on what these
amount = "amount" #: actually 'mean'.param_dict = {Constants.mw: base_units[Constants.mass]/base_units[Constants.amount]}
If the wordiness bothers you, you could alias the class to a short abbreviation like _C
In the snippet of code above, there are actually two sets of magic string constants and I think that if we were to implement thus we would want to create separate classes for each:
- A set of standard names for properties (probably part of
property_base.py) - A set of recognized units of measurement (probably part of
property_meta.py)
Do others have thoughts on this, and how important do we think this is?