Message60513
Logged In: YES
user_id=1039782
I'm not sure what you mean by 'make your classes new-style'.
According to
http://www.python.org/doc/2.3.4/ref/specialnames.html, the
__getitem__ method should be used, and the __getslice__
method is deprecated.
If you subclass the built-in list type, then the __getitem__
method is *not* called when subscripting with a slice.
Instead, the __getslice__ method is called. Try it out.
So I can't see any reasonable way to get around this bug.
You can try and modify the class C shown above, so that it
behaves correctly. I don't think you will be able to do it
without putting in special "workaround" code to avoid this
Python bug.
y = C([1, 2, 3])
>>> print y[-7:-5] # should be [].
|
|
Date |
User |
Action |
Args |
2008-01-20 09:56:57 | admin | link | issue974635 messages |
2008-01-20 09:56:57 | admin | create | |
|