Op 24-11-15 om 20:15 schreef Ian Kelly: >> But no matter what you want to call it. The dis module shows that >> -42 is treated in exactly the same way as 42, which is treated >> exactly the same way as () or as (5, 8, 13) which is treated >> differently from [] or [5, 8, 13]. > > This is an implementation detail. The compiler would also be free to > compile -42 into byte code as the negation of the constant 42. That 42 > is a literal, on the other hand, is part of the language > specification.
I think you are picking nits. Sure the byte code could compile -42 into a byte code for 42 and a negation. Just as it could compile 42 into byte code for adding 32, 8 and 2. The point is, that the reverse isn't true. It couldn't compile [5, 8, 13] into a LOAD_CONST. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list