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

Remove mutable default arguments in LinkStep #24

Open
riley-harper opened this issue Aug 2, 2022 · 1 comment
Open

Remove mutable default arguments in LinkStep #24

riley-harper opened this issue Aug 2, 2022 · 1 comment
Labels
type: bug Something isn't working

Comments

@riley-harper
Copy link
Contributor

There's a discussion of mutable default arguments here: https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument. I didn't know that before! There are some empty lists passed as default arguments in the constructor for LinkStep. This isn't causing any issues right now, but it could cause issues in the future, as it gives many different places in the code unwitting write access to the same lists.

Let's replace the lists with tuples or do something similar to prevent the issue.

@riley-harper riley-harper added the type: bug Something isn't working label Aug 2, 2022
@riley-harper
Copy link
Contributor Author

There are a few other places where there are mutable default arguments as well.

  • hlink.linking.link_run.run_register_python()'s args argument ([])
  • hlink.linking.link_run.run_register_sql()'s t_ctx argument ({})
  • hlink.linking.core.comparison_features.get_features()'s pregen_features argument ([])
  • Others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant