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

copy resolve mut arg in funcs, methods #409

Merged
merged 2 commits into from
Jun 12, 2024
Merged

copy resolve mut arg in funcs, methods #409

merged 2 commits into from
Jun 12, 2024

Conversation

ArtemIsmagilov
Copy link
Contributor

this PR copy resolver problem #408

@ArtemIsmagilov
Copy link
Contributor Author

ArtemIsmagilov commented Jun 12, 2024

I can, of course, strictly rewrite. At your discretion

if arg is None:
    arg = {}

@tobixen tobixen merged commit f3b83d6 into python-caldav:master Jun 12, 2024
8 checks passed
@tobixen
Copy link
Member

tobixen commented Jun 12, 2024

I think it's fine.

In most cases the dicts and lists passed as parameters are supposed to be read-only, then having {} or [] as default value isn't harmful. At the other hand, there is no way to enforce or even indicate that objects passed as parameters shouldn't be modified by a method. Passing None is definitively best practice, and the param or {}-style is compact and easily understandable.

@ArtemIsmagilov ArtemIsmagilov deleted the copy-resolver-mut-arg-in-funcs-methods branch June 12, 2024 17:38
tobixen pushed a commit that referenced this pull request Oct 20, 2024
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