On 31 Aug 2005 07:26:48 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>Op 2005-08-30, Bengt Richter schreef <[EMAIL PROTECTED]>: >> On 30 Aug 2005 10:07:06 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> >>>Op 2005-08-30, Terry Reedy schreef <[EMAIL PROTECTED]>: >>>> >>>> "Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message >>>> news:[EMAIL PROTECTED] >>>> >>>>> Really it's x[-1]'s behavior that should go, not find/rfind. >>>> >>>> I complete disagree, x[-1] as an abbreviation of x[len(x)-1] is extremely >>>> useful, especially when 'x' is an expression instead of a name. >>> >>>I don't think the ability to easily index sequences from the right is >>>in dispute. Just the fact that negative numbers on their own provide >>>this functionality. >>> >>>Because I sometimes find it usefull to have a sequence start and >>>end at arbitrary indexes, I have written a table class. So I >>>can have a table that is indexed from e.g. -4 to +6. So how am >>>I supposed to easily get at that last value? >> Give it a handy property? E.g., >> >> table.as_python_list[-1] > >Your missing the point, I probably didn't make it clear. > >It is not about the possibilty of doing such a thing. It is >about python providing a frame for such things that work >in general without the need of extra properties in 'special' >cases. > How about interpreting seq[i] as an abbreviation of seq[i%len(seq)] ? That would give a consitent interpretation of seq[-1] and no errors for any value ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list