[Python-bugs-list] [ python-Bugs-443600 ] overload of the slicing operator

noreply@sourceforge.net noreply@sourceforge.net
Sun, 22 Jul 2001 13:22:01 -0700


Bugs item #443600, was opened at 2001-07-22 13:22
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=443600&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus Daniel (spacy73)
Assigned to: Nobody/Anonymous (nobody)
Summary: overload of the slicing operator

Initial Comment:
It's impossible to overload the slicing operator
to take two float-values.


PythonWin 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit 
(Intel)] on win32.
>>> class a:
... 	def __getitem__(self, index):
... 		print repr(index)
... 
>>> 
>>> aa=a()
>>> 
>>> aa[1.5]
1.5
>>> 
>>> aa[1.5:2.5]
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: slice indices must be integers
>>>
>>> aa[1.5:2.5:3.5]
slice(1.5, 2.5, 3.5)
>>> 

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=443600&group_id=5470