ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 17 Oct 2018 07:33:16 +0200Is there any difference between the variables b and *b in these two statements? If so, what is it?https://ask.sagemath.org/question/43966/is-there-any-difference-between-the-variables-b-and-b-in-these-two-statements-if-so-what-is-it/
(a, b, c) = 1, 2, 3
(a, *b, c) = 1, 2, 3Tue, 16 Oct 2018 15:54:43 +0200https://ask.sagemath.org/question/43966/is-there-any-difference-between-the-variables-b-and-b-in-these-two-statements-if-so-what-is-it/Answer by nbruin for <pre><code> (a, b, c) = 1, 2, 3
(a, *b, c) = 1, 2, 3
</code></pre>
https://ask.sagemath.org/question/43966/is-there-any-difference-between-the-variables-b-and-b-in-these-two-statements-if-so-what-is-it/?answer=43969#post-id-43969The second is a syntax error in Python 2. In Python 3, the second one is valid. To see the difference, print b after both cases and compare. Hint: (a, *b, c) = (1,2,3,4) does not give an error.
This is really a python question. It has very little to do with sage specifically (especially because it doesn't quite run flawlessly on python 3 yet).Wed, 17 Oct 2018 07:33:16 +0200https://ask.sagemath.org/question/43966/is-there-any-difference-between-the-variables-b-and-b-in-these-two-statements-if-so-what-is-it/?answer=43969#post-id-43969