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

Split apart the index argument to the replace_subject,trial,test functions into idx_new and idx_out #395

Merged
merged 12 commits into from
Jul 26, 2023

Conversation

JHopeCollins
Copy link
Collaborator

@JHopeCollins JHopeCollins commented Jul 25, 2023

The replace_* functions previously only accepted a single index argument. If only one of the new/old things were indexable (i.e. a mixed space or a tuple) then the index was used for that one. If both were indexable then the index was used for both. If neither was indexable then it was silently ignored. This is error prone because the index argument can mean different things depending on the other arguments, and it is silently ignored rather than warning/erroring when it isn't used.

This PR changes the replace_* functions to take separate old_idx and new_idx for indexing the thing being replaced (old) or the thing replacing (new). They will also error if an index is given but not used.

@JHopeCollins JHopeCollins changed the base branch from main to restructure_fml July 25, 2023 13:53
gusto/fml/replacement.py Outdated Show resolved Hide resolved
gusto/fml/replacement.py Outdated Show resolved Hide resolved
gusto/fml/replacement.py Outdated Show resolved Hide resolved
@JHopeCollins JHopeCollins linked an issue Jul 26, 2023 that may be closed by this pull request
@tommbendall tommbendall merged commit 2b311c3 into restructure_fml Jul 26, 2023
1 check passed
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.

Fix replace for replacing from larger spaces again...
3 participants