[Python-3000] Making more effective use of slice objects in Py3k

Delaney, Timothy (Tim) tdelaney at avaya.com
Mon Aug 28 02:24:41 CEST 2006


Jim Jewett wrote:

> On 8/27/06, Delaney, Timothy (Tim) <tdelaney at avaya.com> 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.

Tim Delaney


More information about the Python-3000 mailing list