Implement a Python generator function called unique iter(src, key=None) that yields elements from an…
Implement a Python generator function called unique iter(src, key=None) that yields elements from an…: a task in repo2rlenv-r2e (Harbor dataset). Behavior requirements: - src must be iterable; if it is not, raise a TypeError . - key controls how uniqueness is determined: - If key is None (the…
The task
Behavior requirements: - `src` must be iterable; if it is not, raise a `TypeError`. - `key` controls how uniqueness is determined: - If `key` is `None` (the default), each element is its own key. - If `key` is a callable, it is called with each element and the return value is the key. - If `key` is a string, it is…
Part of FineEnvs/repo2rlenv-r2e.