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

Avoid mutable default arguments #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Oct 29, 2022

I believe this is not needed here, but you may change back None[] at the beginning of the modified functions:

def modified_function(machine_code=None):
    machine_code = machine_code or []

The above will change machine_code to [] not only if it is None, but also False or 0. But I think it is OK in this context.

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review October 29, 2022 09:04
@DimitriPapadopoulos
Copy link
Contributor Author

And argtypes=() is OK because tuples are not mutable.

@workhorsy
Copy link
Owner

I want to merge this later, as it changes the API, and will require me to bump the version up to 10.0.0.

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.

2 participants