Complete worked example
python
def add_saved(role_id, saved=None):
result = [] if saved is None else saved.copy()
if role_id not in result:
result.append(role_id)
return result- Reasoning
- Each omitted collection is newly allocated and supplied lists are copied.