That makes sense, so these are kind of 'views' over a sequence, but ones that implement a copy-on-write when the underlying object is modified in any way?
I can see this being super hard/impossible to implement reliably, but would be a pretty nice addition if it can be done. On Wed, Dec 9, 2020 at 12:25 PM Mathew Elman <mathew.el...@ocado.com> wrote: > I agree that if you are using them as iterables, then the type is usually > not important because you are treating their type as just iter-able. The > lazy iterable would more or less just be the same as passing in > `iter(sequence)`. > > This is for other use cases where the use of the object is specific to the > type, e.g. a case where in the outer scope you construct a list and mutate > it but when it is passed to an inner scope, you want to enforce that it can > be accessed but not mutated. Likewise if lazy built in types were > implemented in python then getting a slice of a sequence could also be done > lazily, whereas my understanding at the moment is that it has to create a > whole new sequence. > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/ZQIXX5632QT7QH5YCZGTTLPJ5ZQF7XOH/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LGXP6YBO5URDFJ7RIQ3OBFQ7MUQTDMWB/ Code of Conduct: http://python.org/psf/codeofconduct/