"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote:
> 
> Jim Jewett wrote:
> 
> > On 8/27/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote:
> >> 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 -
> > 
> > Does it still matter if we're looking only at immutable sequences,
> > such as text? 
> 
> Actually, yes. I think it should be an explicit operation to say "I'm
> taking a small view of this large string, which will result in the large
> string existing until the view goes away".
> 
> Currently the way to do that is to have a method. I'm simply proposing
> that we reserve syntax that is currently not used to prevent it from
> being used for another, less appropriate usage. It may never be used at
> all.

In what I have been attempting to propose, no text methods would ever
return a view.  If one wants a view of text, one needs to manually
construct the view via 'view = textview(st, start, stop)' or some
equivalent spelling.  After that, any operations on a view returns views
(with a few exceptions, like steps != 1).

The seemingly proposed textobj(start:stop) returning a view is not
terribly intuitive, as () and [] aren't so terribly different from each
other to not confuse someone initially.  Never mind that it would be a
syntax addition for the equivalent of a small subset of operations on
currently existing objects.


 - Josiah

_______________________________________________
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

Reply via email to