<p>I want to do some pattern matching on lists in Python. For example, in Haskell, I can do something like the following:</p>

<pre><code>fun (head : rest) = ...
</code></pre>

<p>So when I pass in a list, <code>head</code> will be the first element, and <code>rest</code> will be the trailing elements.</p>

<p>Likewise, in Python, I can automatically unpack tuples:</p>

<pre><code>(var1, var2) = func_that_returns_a_tuple()
</code></pre>

<p>I want to do something similar with lists in Python. Right now, I have a function that returns a list, and a chunk of code that does the following:</p>

<pre><code>ls = my_func()
(head, rest) = (ls[0], ls[1:])
</code></pre>

<p>I wondered if I could somehow do that in one line in Python, instead of two.</p>

That's a very much a 'pure functional' approach and as such is a sensible idiom in Haskell but it's probably not so appropriate to Python.  Python only has a very limited concept of
patterns
in this way - and I suspect you might need a somewhat more rigid type system to implement that sort of construct (
erlang
buffs invited to disagree here).
What you have is probably as close as you would get to that idiom, but you are probably better off using a list comprehension or imperative approach rather than recursively calling a function with the tail of the list.
As has been
stated
on a few occasions
before
, Python is not actually a functional language.  It just borrows ideas from the FP world.  It is not inherently
Tail Recursive
in the way you would expect to see embedded in the architecture of a functional language, so you would have some difficulty doing this sort of recursive operation on a large data set without using a lot of stack space.