Rats! vararg assignments don't work

samwyse samwyse at gmail.com
Thu Jul 12 13:39:31 CEST 2007


On May 30, 7:29 am, Sion Arrowsmith <s... at chiark.greenend.org.uk>
wrote:
> samwyse <dejan... at email.com> wrote:
> >>samwysewrote:
> >>>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())

Hey, I like that!  Thanks!




More information about the Python-list mailing list