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

Should we have both operators and named functions/methods for set operations? #18654

Open
bmcdonald3 opened this issue Oct 28, 2021 · 1 comment

Comments

@bmcdonald3
Copy link
Member

Python has all of the Chapel operators and additionally an equivalent named method as well, but Chapel today only supports the operators. The named methods could be more attractive/understandable to some users and also potentially be a gain when FCFs are more fully featured.

Set operators

Chapel Python Operator Python method
| | union()
+,add() -- add()
& & intersection()
- - difference()
^ ^ symmetric_difference()
<= <= issubset()
< < --
>= >= issuperset()
> > --

Before implementing this, the decision of whether or not to have these be functions (intersection(a,b)) or methods (a.intersection(b)). The challenge with having them be methods is deciding if we want the method to update the calling set or return a new set, where the answer with functions is more clear, that a new set wold be returned. (Python methods return a new set FWIW).

@bradcray
Copy link
Member

Good summary of the issue! Adding a quick note that this is a non-breaking change, so could be done after Chapel 2.0 if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants