plan-be / plan-be/iode

PYTHON: implement special methods __lt__, __le__, __gt__, __ge__, __eq__ and __neq__

Open
#986 3 comments 0 reactions 1 assignee View on GitHub

@alixdamman is already working on this.

Since Jun 23, 2025.

difficulty: high python
Dominant language
C++
Stars
2
Forks
1
Avg merge
7h 35m
Merged PRs (30d)
13

Description

Non-numerical IODE objects

The IODE databases for Comments, Equations, Identities, Lists and Tables are essentially dictionaries {name: object}.

IODE Comments and Lists are just strings. For the other databases, dedicated classes Equation, Identity, Scalar and Table has been implemented both in C++ and Python. They have their own implementation of __eq__.

It would be nice to override the special methods __eq__ and __neq__ for the databases too.
The question is, what kind of object to return ?

A very naive implementation would be to return un simple Python dict(str, bool) and use this dict in __getitem__ and __setitem__. A second possibility is to return a pandas Series. A third possibility is to implement dedicated classes Bool[Comments|...|Tables] but with which attributes and methods ?

Numerical IODE objects

For the IODE Scalars and Variables, it would be nice to have also implementation for __lt__, __le__, __gt__ and __ge__.

The case of Variables is tricky since it represents 2 dimensional data: (dimensions = names and periods).
One possibility for the Variables is a Python class BoolVariables with 3 attributes: the list of names, the sample (first_period:last_period) and a boolean 2D Numpy ndarray. Another possibility is to have a C++ version of BoolVariables and use Cython to wrap it.

@gdementen @yvdabb Any thoughts or advices would be welcome

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.