Tom Ritchford
Jul 15, 2024

--

Not at all. An iterable might be evaluated lazily; or it could be a tuple of tuples; or it could be .items() from another dict, or even .keys() or .values() from a dict, if they are made up of pairs, or a generator function.

In particular, it's inefficient if you have an iterator to create a list out of it and then make a dict out of that.

--

--

No responses yet