No, this isn't the same in Python. You are looking for:
sage: R.<x0,x1,x2>=QQ[]
sage: S = QQ['x0,x1,x2,x3']
sage: p=S.random_element()
sage: p.subs(x2=x2)
and
sage: p.subs(**{'x2':x2})
-7/2*x1*x2 + 1/2*x2^2 - x0*x3 + 1/165*x1 + 3
Note the two stars. The reason why the subs function accepts a dictionary is
that its signature is:
p.subs(self, fixed, **kw=None)
i.e. it also accepts a dictionary 'fixed'. This dictionary expects its keys to
be variables and not strings of variable names.
Cheers,
Martin
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://www.informatik.uni-bremen.de/~malb
_jab: martinr...@jabber.ccc.de