converting from perl: variable sized unpack
Peter Hansen
peter at engcorp.com
Mon Jul 16 08:03:15 EDT 2001
Duncan Booth wrote:
> The Python equivalent to the Ruby trick really isn't that much longer, and
> to my mind has the advantage of showing more clearly the programmer's
> intent:
> (a, b), c = sequence[:2], sequence[2:]
Or perhaps even more readable:
a, b = sequence[:2]
c = sequence[2:]
:-)
--
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com
More information about the Python-list
mailing list