[Python-Dev] A Horrible Inconsistency (original) (raw)

Jason Orendorff jason.orendorff at gmail.com
Fri May 26 18:50:58 CEST 2006


On 5/26/06, Facundo Batista <facundobatista at gmail.com> wrote:

I think that we can do one of the following, when we found "-1 * (1, 2, 3)":

- Treat -1 as 0 and return an empty tuple (actual behavior). - Treat the negative as a reverser, so we get back (3, 2, 1). - Raise an error.

No, no, no. The important invariant is that n * seq is loop(seq)[:n*len(seq)] where loop(seq) is an endless loop of the elements of seq.

So obviously, if n is negative, the result should be an infinite sequence that's == to loop(seq).

-j



More information about the Python-Dev mailing list