If have a list A of polynomials in x and y and want the coefficients of x. Here is what I do:
var('y')
A = [x, y, xy + 3y^2]
for p in A :
print p.coefficients(x)
And here is what I get:
[[1, 1]]
[[y, 0]]
[[3*y^2, 0], [y, 1]]
That's fine. My next list to process is
B = [1, x, y, xy + 3y^2]
And here is what I get:
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'coefficients'.
I expected the answer 0 as the coefficient of x of the polynomial p(x, y) = 1 is 0.
How do I get around this behavior of Sage?