News for hackers. Stuff that matters.
Re:Python built-ins worth learning (2019) by mturmon on Thursday March 24, 2022 @01:54AM (#30786729)
Tuple, list, and numpy array are all different isinstance()’s, so I’d have to call them all out. len() avoids that.
Re:Python built-ins worth learning (2019) by saila on Wednesday March 30, 2022 @12:39AM (#30851537)
This is incorrect, because you can generally do this for sequence types:

    isinstance(items, Sequence)
Or perhaps:

    isinstance(items, Iterable)  # works with numpy arrays
Or, equivalent to using len() for type checking, you could do:

    isinstance(items, Sized)