I read some very old answers on this(10 years), and they say that in python 2.x this quality of iteration was just presumed.
But what about modern python like 3.9 ? Can I assume an item and object can be iterated ?
Abi
I read some very old answers on this(10 years), and they say that in python 2.x this quality of iteration was just presumed.
But what about modern python like 3.9 ? Can I assume an item and object can be iterated ?
Abi
The shining new typing
module is exactly for that. It contains all types.
from typing import Iterable
isinstance([], Iterable) # True
isinstance(None, Iterable) # False