On Sat, 5 Aug 2023 at 09:36, dn via Python-list <python-list@python.org> wrote: > Faced with a situation where an argument may be a scalar-value or an > iterable, I'll presume the latter, eg throw it straight into a for-loop. > If that fails (because the argument is a scalar), use try-except to > re-route the logic.
That's great as long as you aren't expecting to handle strings. The string "spam" is sometimes equivalent to the list ["s", "p", "a", "m"] and sometimes not. ChrisA -- https://mail.python.org/mailman/listinfo/python-list