Skip to content

Implement FusedVariable.__eq__? #179

@tyralla

Description

@tyralla

Node.variable can be the name of one or more types (often "Q"), a specific type, or a collection of types stored in a FusedVariable instance. This flexibility sometimes complicates comparisons. Maybe we should implement the following behaviour:

    For convenience, |FusedVariable| supports equality comparisons with other fused
    variables (Are all handled variable types identical?), individual sequences (Is the
    given sequence type among the handled types?), and sequence names (Is any of the
    handled types the given name?):

    >>> assert T == Temp
    >>> assert T != E
    >>> assert T == meteo_inputs_Temperature
    >>> assert meteo_inputs_Temperature == T
    >>> assert T != evap_inputs_ReferenceEvapotranspiration
    >>> assert evap_inputs_ReferenceEvapotranspiration != T
    >>> assert T == "TemL"
    >>> assert "TemL" == T
    >>> assert T != "ReferenceEvapotranspiration"
    >>> assert "ReferenceEvapotranspiration" != T

Very convenient, but a little surprising, and I did not check thoroughly for potential pitfalls. (@sivogel: You encountered related problems a few times. Would this approach help?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions