Why not?  You can compare numpy array views, can't you?

In [4]: a = np.array([1,2])

In [5]: a[1:] < a[:1]
Out[5]: array([False], dtype=bool)

On Sat, May 9, 2015 at 4:51 AM, 'Mark Lawrence' via python-ideas <python-ideas@googlegroups.com> wrote:
On 09/05/2015 08:31, Andrew Barnert via Python-ideas wrote:
On May 8, 2015, at 21:04, Nikolaus Rath <Nikolaus@rath.org> wrote:

On May 07 2015, Steven D'Aprano <steve-iDnA/YwAAsAk+I/owrrOrA@public.gmane.org> wrote:
But a view would be harmful in this situation:

s = "some string"*1000000
t = s[1:2]  # a view maskerading as a new string
del s

Now we keep the entire string alive long after it is needed.

How would you solve the first problem without introducing the second?

Keep track of the reference count of the underlying string, and if it
goes down to one, turn the view into a copy and remove the sliced
original?

Of course I could be wrong; we won't really know until someone actually builds at least an implementation and tests it.

Well they can, but I found a major problem with views is that you can't compare them and so can't sort them, thus rendering them useless for a lot of applications.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

--

--- You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-ideas/II-4QRDb8Is/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-ideas+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.