Maurice requested a short-cut for
"factor = model.units.get_conversion_factor(1 * current_units, secondary_units)
ideally I guess I'd do something like factor = model.get_conversion_factor(eq.lhs, desired_units) (and return 1.0 if the units are the same)?"
I would also provide a function
get_conversion_factor(unit, to_unit)
If I do this by overloading the existing function I will have to give the arguments keywords - and thus break any existing code.
Options are:
- add keyword arguments and break code (but then you would be able to have convert express -> unit; quantity -> unit; unit -> unit)
- Leave existing function as is and create a new function with the keyword args. So we get all functionality, dont break code BUT would need a newly named function e.g. get_convers_factor or some variant
Thoughts ??
Maurice requested a short-cut for
"factor = model.units.get_conversion_factor(1 * current_units, secondary_units)
ideally I guess I'd do something like factor = model.get_conversion_factor(eq.lhs, desired_units) (and return 1.0 if the units are the same)?"
I would also provide a function
get_conversion_factor(unit, to_unit)
If I do this by overloading the existing function I will have to give the arguments keywords - and thus break any existing code.
Options are:
Thoughts ??