Skip to content

Shortcut for get_conversion_factor #97

@skeating

Description

@skeating

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:

  1. add keyword arguments and break code (but then you would be able to have convert express -> unit; quantity -> unit; unit -> unit)
  2. 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 ??

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions