I would like to have a place for my physical constants.
The following answer is already a starting point: How-to import constants in many files
So I have a seperate file called constants.py which I import into my projects.
Now, i would like to save and access additional information:
The resulting interface should be like:
import constants as c print c.R >>> 287.102 print c.R.units >>> J/(kg K) print c.R.doc >>> ideal gas constant
Calculations should use c.R to access the value.
It is basically a class, which behaves like the float class but holds two additional strings: units and documentation. How can this be designed?