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

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

Open
MaxGhenis opened this issue Feb 12, 2022 · 0 comments
Open

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

MaxGhenis opened this issue Feb 12, 2022 · 0 comments

Comments

@MaxGhenis
Copy link
Contributor

MaxGhenis commented Feb 12, 2022

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:

agg_func = dict(
add=lambda x, y: x + y, multiply=lambda x, y: x * y, max=max_, min=min_
)[agg_func]

@MaxGhenis MaxGhenis changed the title Change and_, or_ to return bools Change and_, or_ to use & and | instead of * and + operators Feb 12, 2022
@MaxGhenis MaxGhenis changed the title Change and_, or_ to use & and | instead of * and + operators Change and_ and or_ to use & and | instead of * and + operators Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant