UserList.__getslice__(): copy.copy(self.data) vs. self.__class__(self.data).

Bernhard Herzog herzog at online.de
Wed Mar 15 08:02:47 EST 2000


Tom Funk <_spam_sux_tdfunk at _spam_sux_nettally.com> writes:

> Hi, Bernhard:
> 
> In an article posted 15 Mar 2000 00:25:29 +0100,
> Bernhard Herzog (herzog at online.de) said:
> > >  Note that missing 
> > >  i or j in the slice expression are replaced by zero or 
> > >  sys.maxint, respectively, 
> ... 

You snipped the important part:

   and no further transformations on 
  the indices is performed. The interpretation of negative 
  indices and indices larger than the length of the sequence 
  is up to the method. 


> > It seems negative indices are automatically subtracted from the length.
> 
> Actually, this behavior matches the description in the Language Reference 
> Manual.

I was referring to the last sentence which claims that negative indices
have to be interpreted by the method, which is not true for simple
slices. The other part of the reference manual that you quoted describes
this correctly.

> OK, you and Alex win: UserList stays as it is, and I sit back down in my 
> chair and shut-the-heck-up <g>. 
> 
> I was thinking that we'd be left with why test_userlist.py was 
> failing.... but NOT!  Even that seems to have remedied itself:
> 
>   D:\Python\Lib\test>python test_userlist.py
> 
>   D:\Python\Lib\test>
> 
> So, I'm truly sorry to have wasted everyone's time.  I was *way* off-
> based with my testing/assessment/findings.

Oh, this is probably Guido's time machine again. Perhaps there was a bug
in python 1.5.2 and Guido used his time machine to fix it, but for some
strange reason the ripples in the space-time continuum this always
causes have only just cought up with you. <wink>


-- 
Bernhard Herzog   | Sketch, a drawing program for Unix
herzog at online.de  | http://sketch.sourceforge.net/



More information about the Python-list mailing list