| 1 | initial version |
One solution is to force g into the univariate polynomial ring with respect to which you want to take coefficients:
sage: ZZ['a']['k'](g).coefficients()
[1, a, 1]
By mixing var('a') and _.<k> you're creating an element that has a rather complicated representation. You're better off either sticking entirely with var('a,k') or with defining the appropriate polynomial ring explicitly.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.