On Thu, 4 Jun 2015 07:08 am, Rustom Mody wrote:

> So it means that indices can give indexerror; slices cannot?

If you write your own class with a __getitem__ method, you can have it do
anything you like, including raise an exception.

Built-in sequence types like list, str and tuple, however, allow slicing to
extend beyond the first and last indexes without error.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to