How to access the low digits of a list
Steven D'Aprano
steve at pearwood.info
Thu Jun 4 09:27:33 EDT 2015
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
More information about the Python-list
mailing list