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

refactor: no return for add* python helpers #1404

Merged
merged 15 commits into from
Aug 16, 2022

Conversation

andiwand
Copy link
Contributor

@andiwand andiwand commented Aug 8, 2022

after working on the full chain doc I wondered why we do s = addSomething(s, ...) all the time. to me it looks kind of confusing as the reader might think s is changing every time we add something.

maybe we want to remove the return value of the add functions completely? @paulgessinger @timadye

@andiwand andiwand added this to the next milestone Aug 8, 2022
@codecov
Copy link

codecov bot commented Aug 8, 2022

Codecov Report

Merging #1404 (04917a1) into main (4e9aa53) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1404   +/-   ##
=======================================
  Coverage   48.59%   48.59%           
=======================================
  Files         380      380           
  Lines       20577    20577           
  Branches     9429     9429           
=======================================
  Hits         9999     9999           
  Misses       4093     4093           
  Partials     6485     6485           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@timadye
Copy link
Contributor

timadye commented Aug 8, 2022

Hi @andiwand,

This was originally proposed by @asalzburger in #1098, so we should get his feedback.

I think the idea is to emphasize that the Sequencer object is modified by the routine, even though it returns the same object. But maybe it is overkill to get the user/caller do it.

For myself, I don't have a strong opinion either way, so I wouldn't mind if it was changed - as long as it was changed consistently in all the examples and documentation.

Thanks,
Tim.

@andiwand
Copy link
Contributor Author

andiwand commented Aug 8, 2022

hmm makes sense. I just wonder if the return value emphasizes this enough as you can easily skip it without any loss of functionality. I guess what would be nice is something like s.addSomething(...). we might be able to achieve this by wrapping the sequencer now that everything is in simulation.py or reconstruction.py?

@timadye
Copy link
Contributor

timadye commented Aug 9, 2022

That could be easier to use, but could make the implementation harder to understand. The aim with this interface is to make it simple to get started, but not to discourage people playing inside the add*() functions' code. I'll leave it to others to comment on this case, because I am sometimes similarly tempted to improve the interface.

@paulgessinger
Copy link
Member

I would prefer not to wrap the sequencer. My original reason for having it as an argument an return value was that you could pass in None and the original run* function would create a default sequencer. I guess this is not relevant anymore with the add* functions.

I think my preferred solution would be to drop the return value consistently.

@andiwand
Copy link
Contributor Author

I agree - I will draft these changes

@timadye
Copy link
Contributor

timadye commented Aug 15, 2022

Cool. Can you change the PR title, since this doesn't any more just affect the OOD.

@andiwand andiwand changed the title test: minor full_chain_odd changes test: refactor no return for add* python helpers Aug 15, 2022
@andiwand andiwand changed the title test: refactor no return for add* python helpers test: refactor: no return for add* python helpers Aug 15, 2022
@andiwand andiwand changed the title test: refactor: no return for add* python helpers test: refactor - no return for add* python helpers Aug 15, 2022
@andiwand
Copy link
Contributor Author

I made the changes @timadye. I left the None return type for now, with the hope that a linter might notify the consumer that a return value should not be expected

Co-authored-by: Tim Adye <T.J.Adye@rl.ac.uk>
Copy link
Contributor

@timadye timadye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all looks good to me

@paulgessinger paulgessinger changed the title test: refactor - no return for add* python helpers refactor: no return for add* python helpers Aug 16, 2022
@paulgessinger paulgessinger added automerge backport develop/v19.x Backport this PR to the v19.x series labels Aug 16, 2022
@kodiakhq kodiakhq bot merged commit afb91a5 into acts-project:main Aug 16, 2022
@acts-project-service
Copy link
Collaborator

The backport to develop/v19.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-develop/v19.x develop/v19.x
# Navigate to the new working tree
cd .worktrees/backport-develop/v19.x
# Create a new branch
git switch --create backport-1404-to-develop/v19.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 afb91a583e6db641c9b39354c7494da5726b8681
# Push it to GitHub
git push --set-upstream origin backport-1404-to-develop/v19.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-develop/v19.x

Then, create a pull request where the base branch is develop/v19.x and the compare/head branch is backport-1404-to-develop/v19.x.

asalzburger pushed a commit to asalzburger/acts that referenced this pull request Aug 18, 2022
after working on the full chain doc I wondered why we do `s = addSomething(s, ...)` all the time. to me it looks kind of confusing as the reader might think `s` is changing every time we add something.

maybe we want to remove the return value of the add functions completely? @paulgessinger @timadye
@paulgessinger paulgessinger added backport develop/v19.x Backport this PR to the v19.x series and removed backport develop/v19.x Backport this PR to the v19.x series labels Aug 22, 2022
acts-project-service pushed a commit that referenced this pull request Aug 22, 2022
after working on the full chain doc I wondered why we do `s = addSomething(s, ...)` all the time. to me it looks kind of confusing as the reader might think `s` is changing every time we add something.

maybe we want to remove the return value of the add functions completely? @paulgessinger @timadye

(cherry picked from commit afb91a5)
kodiakhq bot pushed a commit that referenced this pull request Aug 22, 2022
…p/v19.x] (#1457)

Backport afb91a5 from #1404.
---
after working on the full chain doc I wondered why we do `s = addSomething(s, ...)` all the time. to me it looks kind of confusing as the reader might think `s` is changing every time we add something.

maybe we want to remove the return value of the add functions completely? @paulgessinger @timadye
paulgessinger pushed a commit to paulgessinger/acts that referenced this pull request Aug 31, 2022
after working on the full chain doc I wondered why we do `s = addSomething(s, ...)` all the time. to me it looks kind of confusing as the reader might think `s` is changing every time we add something.

maybe we want to remove the return value of the add functions completely? @paulgessinger @timadye
kodiakhq bot pushed a commit that referenced this pull request Aug 31, 2022
…elope/v19.x] (#1472)

Backport 9488925 from #1404.
---

after working on the full chain doc I wondered why we do `s = addSomething(s, ...)` all the time. to me it looks kind of confusing as the reader might think `s` is changing every time we add something.
@paulgessinger paulgessinger modified the milestones: next, v20.1.0 Sep 2, 2022
@andiwand andiwand deleted the refactor-minor-full-chain-odd branch October 26, 2022 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport develop/v19.x Backport this PR to the v19.x series
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants