Raymond Hettinger wrote:

How would you describe the creation of a lazy result
that keeps a reference to the underlying buffer?

I'd call it a view. There is plenty of precedence for this
kind of object in Python -- I gave a few examples before.

The distinguishing feature of ropes, as I understand the
term, is that you get a lazy object when you *combine* other
objects, e.g. concatenating strings.

That's not being asked for here -- there is only taking
apart going on, not putting together.

It's also different from the oft-rejected idea of lazy
string slicing, because extracting a field would give
you a separate object, e.g. an int or string, not a
reference to the original data object being unpacked.

So I really can't see what harm it could do, except for
maybe a tiny performance reduction in the case where you
extract all the fields, or refer to extracted fields
repeatedly.

Even if that turned out to be the case, and was considered
objectionable, it could still be useful to provide
view-oriented unpacking as an option.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to