Jim Jewett wrote:
> s[start:stop].find(prefix)
No matter what, I really think the obj[start:stop:step] syntax needs to
be consistent in its behaviour - either returning a copy or a view - and
that that behaviour be to return a copy. I'm not at all in favour of
sometimes getting a copy, and sometimes getting a view.
As a bit of an out-there and very premature suggestion ... <wink>
For when/*if* views ever become considered to be a good thing for
builtin classes, etc, may I suggest that the following syntax be
reserved for view creation:
obj{start:stop:step}
mapping to something like:
def __view__(self, slice)
So if you really want a string view, use:
s{1:2}
instead of:
s[1:2]
I don't *think* the syntax is currently legal, and I don't think it
could ever be ambiguous - anyone think of a case where it could be?
Tim Delaney
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com