Skip to content

Scalars should compare equal if the underlying quantity measure is OK #26

@nicoddemus

Description

@nicoddemus

I think Scalar(1, "m") should compare equal to Scalar(100, "cm"). This would allow us to write more natural code like:

if current_tubing_end <= current_open_hole_position:

Instead of being forced to write:

if current_tubing_end.GetValue('m') <= current_open_hole_position.GetValue('m'):

pint works this way:

>>> import pint
>>> ureg = pint.UnitRegistry()
>>> 1* ureg.meter == 100 * ureg.centimeter
True

From this discussion: https://eden.esss.com.br/stash/projects/ESSS/repos/alfasim/pull-requests/1690/overview?commentId=120265

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions