### Extracting coefficients of multivariate polynomials?

If I enter, say:

```
P.<x,y,z> = QQ[]
ex = 6*x*y^2-4*x*y*z+2*x^2*z
ex.coefficients()
```

then Sage returns

```
[6, -4, 2]
```

as it should. My problem is that I'm trying to obtain a list of coefficients when the coefficients are themselves expressions:

```
ex = (1-a^2)*x*y^2+(a-b^2+c)*x*y*z+(b^2-c^2-a)*x^2*z
```

What I want returned is

```
[1-a^2, a-b^2+c, b^2-c^2-a]
```

(the order doesn't matter). If I enter `a, b, c`

as elements of the same polynomial ring as `x, y, z`

then I have the problem of distinguishing the different variables: `x, y, z`

, from `a, b, c`

.

What's the best way to do this?

Thanks,
Alasdair