Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace + and * with | and & for logical operations #136

Open
MaxGhenis opened this issue Jun 25, 2021 · 0 comments
Open

Replace + and * with | and & for logical operations #136

MaxGhenis opened this issue Jun 25, 2021 · 0 comments
Labels
code-health Code quality and maintainability

Comments

@MaxGhenis
Copy link
Collaborator

e.g.:

https://github.com/PSLmodels/openfisca-uk/blob/a22170e16bd85a7cfedc1bc1f50144b6a0138ea3/openfisca_uk/variables/finance/benefit/benefit.py#L133

This works because np.array(True) + np.array(True) = np.array(True), but outside of numpy, True + True = 2. pd.Series(True) + pd.Series(True) = pd.Series(True), but this throws a warning and asks to use | instead.

Replacing bool + bool with bool | bool and bool * bool with bool & bool throughout will clarify the code.

@MaxGhenis MaxGhenis added the code-health Code quality and maintainability label Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-health Code quality and maintainability
Projects
None yet
Development

No branches or pull requests

1 participant