PolicyEngine / openfisca-tools

Python tools for enhancing OpenFisca country packages.
1 stars 1 forks source link

Change `and_` and `or_` to use `&` and `|` instead of `*` and `+` operators #27

Open MaxGhenis opened 2 years ago

MaxGhenis commented 2 years ago

Currently, and_ and or_ are aliases for add_ and multiply_, respectively (or vice versa, they're duplicative). add_ and multiply_ apply + and * operators, respectively. I'd suggest that and_ and or_ instead apply & and | operators, respectively.

This won't change the result: np.array(bool) * np.array(bool) = np.array(bool), for example. But it would be more explicit, and could improve performance.

Relevant code: https://github.com/PolicyEngine/openfisca-tools/blob/e2bc593b29f670f302f2c64b892a3df60b7cc30d/openfisca_tools/model_api.py#L75-L77