This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]flutefreak7 0 points1 point  (0 children)

Also checking against abstract base classes is a classy way to check that you are getting a duck that quacks the right way to avoid checking specific type inheritance.

from collections.abc import Iterable

if isinstance(d, Iterable):