python-caldav / caldav

Apache License 2.0
321 stars 95 forks source link

copy resolve mut arg in funcs, methods #409

Closed ArtemIsmagilov closed 3 months ago

ArtemIsmagilov commented 3 months ago

this PR copy resolver problem #408

ArtemIsmagilov commented 3 months ago

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

if arg is None:
    arg = {}
tobixen commented 3 months ago

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.