On 5/25/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > >>> -1 * (1, 2, 3) > >() > > >>> -(1, 2, 3) > >Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > >TypeError: bad operand type for unary - > > > >We Really Need To Fix This! > > > > > > The second one doesn't bug me. Unary minus on a sequence is meaningless. > > The first is a bit odd. When using the * operator for sequence > repetition, I don't expect it to have the same commutative property as > multiplication. IOW, "seq * n" makes sense but "n * seq" is a bit > weird. Also, I'm not clear on the rationale for transforming negative > repetition counts to zero instead of raising an exception. OTOH, > neither of these has EVER been an issue for me or anyone I know.
It would be very strange if n*s didn't return the same thing as s*n. In fact, I can't even decide which one feels more natural! As to truncation of 0, that's debatable but can't be fixed until py3k -- surely lots of code (perhaps accidentally) depends on it. Still unclear which one \F wanted fixed... -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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