Lazy Evaluation in Python

dk.websolutions
2 min readFeb 23, 2021

The idea of lazy is very helpful and Python already offers this features, which means that the object is evaluated when it is needed, not when it is created.

Some benefits of using it are that reduces the time complexity of an algorithm by discarding the temporary computations and conditionals, allows the language runtime to discard sub-expressions that are not directly linked to the final result of the expression,
allows the programmer to access components of data structures out-of-order after initialization, as long as they are free from any circuits.

--

--