[Tutor] REPL format
Jim Mooney
cybervigilante at gmail.com
Sun Apr 26 03:28:46 CEST 2015
On 25 April 2015 at 17:43, Alan Gauld <alan.gauld at btinternet.com> wrote:
> know what's going on. I seem to recall you are using Python 3,
> is that correct?
>
>
I guess I should specify from now on py3 on win xp
Another question - why does the first assignment work but not the second. I
can see it's a syntax error but if Py can unpack in the first case why
can't it unpack the same thing in the second?
>>> a, *b = 'good', 'bad', 'ugly'
>>> a
'good'
>>> b
['bad', 'ugly']
>>> a, *b = 'ham', 'eggs', 'spam'
>>> a
'ham'
>>> b
['eggs', 'spam']
>>> *b = 'eggs', 'spam'
SyntaxError: starred assignment target must be in a list or tuple
>>>
--
Jim
If you only had one hour left to live, would you spend it on Facebook,
Twitter, or Google Plus?
More information about the Tutor
mailing list