Perl's @foo[3,7,1,-1] ?

Brian Quinlan brian at
Sat Jun 13 17:59:18 EDT 2009

kj wrote:
> In <slrnh37t2p.63e.nick at> Nick Craig-Wood <nick at> writes:
>> However I can't think of the last time I wanted to do this - array
>> elements having individual purposes are usually a sign that you should
>> be using a different data structure.
> In the case I was working with, was a stand-in for the value returned
> by some_match.groups().  The match comes from a standard regexp
> defined elsewhere and that captures more groups than I need.  (This
> regexp is applied to every line of a log file.)
> kj

The common idiom for this sort of thing is:

_, _, _, val1, _, _, _, val2, ..., val3 = some_match.groups()


More information about the Python-list mailing list