News for hackers. Stuff that matters.
Re:Python built-ins worth learning (2019) by dragonwriter on Thursday March 10, 2022 @12:35AM (#30623554)
“supports len()” and “is a Sequence” are fairly reliably equivalent, and using len() fails fast in many cases (e.g., iteration over a potentially infinite iterable) not doing so would not and be less desirable.

Type checking via mypy, pyright, etc., is great, but in library (as opposed to an app) you can't count on consumers doing that, and isinstance() checks don't support duck-typing.

There are no comments on this comment yet.