Greg Ewing wrote: > Nick Coghlan wrote: > >> reversed(seq[start:stop:step]) becomes >> seq[(stop-1)%abs(step):start-1:-step] >> >> An rslice builtin would make the latter version significantly easier >> to read: >> >> seq[rslice(start, stop, step)] > > How would this deal with omitted start and/or stop values?
Badly! (negative indices are screwed, too) This would be an awful lot easier if we could just subclass slice, and do the calculation in the indices() method where we have access to len(seq) in order to deal with an omitted stop value and negative indices. Ah well, never mind. I'll take it back to the Py3k list, and see if I can find some small changes we can make so that slice() doesn't feel like a bolted-on hack that exists solely to avoid the need for a new special method :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com