
On Wed, Dec 9, 2020 at 12:05 PM Mathew Elman <mathew.elman@ocado.com> wrote:
Steven D'Aprano wrote:
On Tue, Dec 08, 2020 at 11:46:59AM -0000, Mathew Elman wrote:
I would like to propose adding lazy types for casting builtins in a lazy fashion. e.g. lazy_tuple which creates a reference to the source iterable and a morally immutable sequence but only populates the tupular container when it or the source is used. What are your use-cases for this? Does this include things like lazy_list, lazy_float, lazy_bool, lazy_str, lazy_bytearray etc?
I would say yes, it should include these types as well. The use case is for when you are casting between types a high number of times to pass them around, especially into another type and back.
Out of morbid curiosity, why would you need to be casting between iterables many times? Don't most consumers treat iterables roughly equally?