Easy to process iterable and no iteration
2 answers
The best optimization of all would be to avoid the nonsense of taking "either a list or a single item" as an argument. But, if you insist, it's better to use try / except to remove the ASAP anomaly and make what is bound to be iterable:
try: iter(list_or_elem)
except TypeError: iterable = [list_or_elem]
else: iterable = list_or_elem
y = max(y, *iterable)
+1
a source to share