Rats! vararg assignments don't work

Sion Arrowsmith siona at chiark.greenend.org.uk
Wed May 30 08:29:27 EDT 2007


samwyse  <dejanews at email.com> wrote:
>> samwyse wrote:
>>>I thought that I'd try this:
>>>     first, *rest = arglist
>>>Needless to say, it didn't work.
> [ ... ]
>My use-case is (roughtly) this:
>     first, *rest = f.readline().split()
>     return dispatch_table{first}(*rest)

first, rest = f.readline().split(None, 1)
return dispatch_table{first}(*rest.split())

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list