Skip to content

Rectify OR and AND of Constraints and AltConstraints #292

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

Merged
merged 2 commits into from
Mar 6, 2023
Merged

Conversation

mih
Copy link
Member

@mih mih commented Mar 6, 2023

Both implementations performed in-place modifications of the left-side constraint. This is not appropriate, because it matches the semantics of __iand__ and __ior__, rather than __and__ and __or__.

This change move away from the in-place implementation and simply returns a new instance. This is cheap.

There is no implementation of __iadd__ and __ior__, although simply renaming the methods would have been enough.

There is no need for it, and it can be done whenever there is actual demand.

Closes #291

Both implementations performed in-place modifications of the
left-side constraint. This is not appropriate, because it matches
the semantics of `__iand__` and `__ior__`, rather than
`__and__` and `__or__`.

This change move away from the in-place implementation and simply
returns a new instance. This is cheap.

There is no implementation of `__iadd__` and `__ior__`, although
simply renaming the methods would have been enough.

There is no need for it, and it can be done whenever there is actual
demand.

Closes datalad#291
It is shorter, it is clearer.

The old class names stay for backward compatibility.

Two more changes:

- the new classes are now also exposed from `__init__.py`
- superfluous comments have been removed

Closes datalad#185
@mih mih merged commit 134e03a into datalad:main Mar 6, 2023
@mih mih deleted the bf-291 branch March 6, 2023 20:44
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

Successfully merging this pull request may close these issues.

Implement AltConstraints.__or__ not __ior__
1 participant