Since you seem to be interested in generating the solutions in the least "brute force" way, here's a different approach to the one I gave earlier that works by iteration rather recursion. This python generator will highly efficiently (and lazily) generate all of the partitions of length $n$ that sum to $s$:
def partitions(n, s):
a = [s] + [0]*(n-1) # start with a = [s,0,0, ..., 0]
while True:
yield list(a)
# now we find the successor of a
# find the left-most non-zero element
k = 0
while a[k] == 0:
k += 1
if k==n-1:
# we have reached the last iteration [0,0,..., s]
# so this will trigger a StopIteration exception
return
a[k+1] += 1
a[0] = a[k]-1
if k>0:
a[k] = 0
But since this is math.stackexchange, I should formalize the mathematical analysis :).
Let $P$ be the set of all sequences of $n$ non-negative integers that sum to $s$.
Let $>$ be the lexicographic ordering on $P$, going from right to left: if $a_{n-1} > b_{n-1}$ then $a > b$; if $a_{n-1} < b_{n-1}$ then $a<b$; otherwise $a_{n-1} = b_{n-1}$ and we move on to comparing $a_{n-2}$ and $b_{n-2}$; and so on.
This is a linear order; the minimal element being $[s, 0, 0, ..., 0]$ and the maximal element being $[0, 0, ..., 0, s]$.
So given some $a \in P$, we want to find the successor $succ(a) = b$ in the linear order - i.e., the unique element $b$ s.t. $\forall c \in P, c > a \rightarrow c \geq b$.
Let $k$ be the smallest index such that $a_k > 0$.
Consider the set $A = \{ b \in P \mid i>k \rightarrow b_i = a_i\}$. $a$ is maximal in this set, since for $b \in A$, we must have $\sum_{i=0}^{k}b_i = a_k$; and thus if any $b_i>0$ for $i<k$, we must have $b_k<a_k$.
Next define the set $B = \{b \in P \mid b_{k+1} = a_{k+1}+1, i>k+1 \rightarrow b_i = a_i\}$. If $b \in B$, then $b > a$; and if $b \in B, c \notin B$ and $b>a, c>a$, then $c>b$; so $succ(a) \in B$.
Therefore $succ(a)$ is the smallest element of $B$; which is defined by:
$$b_0 = a_k-1$$
$$ 0<i\leq k \rightarrow b_i = 0$$
$$ b_{k+1} = a_{k+1}+1$$
$$ i>k+1 \rightarrow b_i = a_i$$
However, since for all $i<k$, $a_i = 0$ by definition of $k$, in our algorithm we can get away with just changing potentially three elements, in place: $a_{k+1}, a_0$, and (if $k>0$), $a_k$.