ValueError vs IndexError, unpacking arguments with string.split

Morten W. Petersen morphex at gmail.com
Fri Nov 30 13:47:43 EST 2018


On Fri, Nov 30, 2018 at 7:25 PM Dan Sommers <
2QdxY4RzWzUUiLuE at potatochowder.com> wrote:

> On 11/30/18 12:00 PM, Morten W. Petersen wrote:
>
>  > I guess syntax could be added, so that
>  >
>  > a, b, @c = some sequence
>  >
>  > would initialize a and b, and leave anything remaining in c.  We could
>  > then call this @ syntax "teh snek".
>
> Close.  ;-)  Try this:
>
>      a, b, *c = [4, 5, 6, 7]
>

☺

I did not know that.  Or maybe I read it somewhere and it was in the
subconscious.

-Morten


-- 
Videos at https://www.youtube.com/user/TheBlogologue
Twittering at http://twitter.com/blogologue
Blogging at http://blogologue.com
Playing music at https://soundcloud.com/morten-w-petersen
Also playing music and podcasting here:
http://www.mixcloud.com/morten-w-petersen/
On Google+ here https://plus.google.com/107781930037068750156
On Instagram at https://instagram.com/morphexx/



More information about the Python-list mailing list