[Patches] [Patch #101388] Backward compatibility hook
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 21 Sep 2000 15:28:20 -0700
Patch #101388 has been updated.
Project:
Category: documentation
Status: Closed
Summary: Backward compatibility hook
Follow-Ups:
Date: 2000-Sep-01 07:41
By: jhylton
Comment:
same deal: postponed for now, but may be considered post 2.0b1
-------------------------------------------------------
Date: 2000-Sep-15 07:17
By: fdrake
Comment:
The test using sys.hexversion may be more readable if sys.version_info is used instead:
if sys.version_info < (2, 0): ...
-------------------------------------------------------
Date: 2000-Sep-15 09:51
By: gvanrossum
Comment:
This is a doc update.
But I believe that it's backwards.
The proper solution is to let __getslice__(self, lo, hi) call self.__getitem__(slice(lo, hi)) -- or self[lo:hi:]; and similar for the others. Then you can write code in __getitem__ that handles slice objects (and tuples of slice objects).
Why does he use max(i,0) etc.? I don't think that's needed or correct!
The version check could be done to make it a bit faster.
-------------------------------------------------------
Date: 2000-Sep-18 04:23
By: ods
Comment:
Why using max(i, 0)
Let seq is the sequence with 5 items. Expression seq[-10:] is equivalent for seq.__getslice__(-5, sys.maxint) or seq.__getitem__(slice(-10, None, None)) but not seq.__getitem__(slice(-5, None, None))!
-------------------------------------------------------
Date: 2000-Sep-18 07:46
By: gvanrossum
Comment:
OK, I understand. Fred, if you want to do something with this, please use the version check you like and add a comment explaining the max() (if it's not already explained nearby).
-------------------------------------------------------
Date: 2000-Sep-21 15:28
By: fdrake
Comment:
Checked in with additional explanation in Doc/ref/ref3.tex revision 1.52.
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=101388&group_id=5470