Negative array indicies and slice()

andrewr3mail at gmail.com andrewr3mail at gmail.com
Mon Oct 29 04:59:06 EDT 2012


On Monday, October 29, 2012 1:38:04 AM UTC-7, Chris Rebert wrote:
> On Mon, Oct 29, 2012 at 1:24 AM, 
> 
> > On Sunday, October 28, 2012 9:44:56 PM UTC-7, alex23 wrote:
> 
> >> On Oct 29, 2:09 pm, Andrew < wrote:
> 
> You never wrapped `a` in a RangedSlicer or otherwise made use of RangedSlicer!
> 
> You wanted:
> 
> a = RangedSlicer([1,2,3,4,5])
> 
> 
> 
> >>>> a.__getitem__( slice(1,5) )
> 
> > [2, 3, 4, 5]
> 
> >
> 
> > Very odd...  I would have expected [1,2,3,4]
> 
> 
> 
> "[2, 3, 4, 5]" is the return value from `a.__getitem__( slice(1,5) )`
> 
> (or, equivalently, from `[1,2,3,4,5][1:5]`). It is not the result of
> 
> "print item"; that line of code is never executed since you never used
> 
> the RangedSlicer class at all.
> 
> 
> 
> Regards,
> 
> Chris

My apology --- I deleted that post; yet it didn't delete... I saw my mistake seconds after posting.

***** gmail.

Note: I subscribed to the python-list, and am able to recieve e-mails, but I don't see how to write a post for this particular thread nor subscribe to this particular thread...

A brief suggestion, or link to a howto would be *much* appreciated.




More information about the Python-list mailing list