Why is __getslice__ still implemented?

Torsten Bronger bronger at physik.rwth-aachen.de
Tue Apr 10 06:49:04 EDT 2007


Hallöchen!

James Stroud writes:

> [...]
>
> Which version of python are you using?

2.4

> chernev 20% /sw/bin/python
> Python 2.5 (r25:51908, Oct 10 2006, 03:45:47)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> py> class Bob(object):

This should be Bob(unicode).

> ...   def __getitem__(self, *args):
> ...     print args
> ...
> py> b = Bob()
> py> b[4:21:2]
> (slice(4, 21, 2),)
> py> b[5:18:21,2:9:2,8,14:4]
> ((slice(5, 18, 21), slice(2, 9, 2), 8, slice(14, 4, None)),)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: bronger at jabber.org
                      (See http://ime.webhop.org for ICQ, MSN, etc.)



More information about the Python-list mailing list