I donβt think so, because your implementation does two completely different things:
- If the argument is a list, it returns it. Thus, the returned list will be a live representation of the argument. Changes in each of the lists are visible in the other.
- If the argument is not a list, it returns a copy of it. The returned list is independent of the argument.
The two things are so different that no sane general purpose library drops them together in one way.
source
share