2.2.2 Annoyance

Michael Hudson mwh at python.net
Mon Nov 24 09:53:56 EST 2003


"Jegenye 2001 Bt" <nospam at nowhere.hu> writes:

> Caveat:
> 
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34)
> Type "help", "copyright", "credits" or "l
> >>> l = [1,2,3]
> >>> l[1]
> 2
> >>> l.__getitem__(1)
> 2
> >>> l.__getitem__(slice(1))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: an integer is required
> >>>
> 
> According to the manuals of Python 2.2.2, passing a slice object to
> __getitem__ is all right and should work...

Really?  Where does it say that?

> For Python 2.3  passing a slice object to __getitem__ does work though.

Yes.  Do you have a good reason for sticking to 2.2?

Cheers,
mwh

-- 
  Python enjoys making tradeoffs that drive *someone* crazy <wink>.
                                       -- Tim Peters, comp.lang.python




More information about the Python-list mailing list