bb schrieb:
sage: x=[a=5, a+=5, a-=3, a*=5, a/=8]
------------------------------------------------------------
File "<ipython console>", line 1
x=[a=Integer(5), a+=Integer(5), a-=Integer(3), a*=Integer(5),
a/=Integer(8)]
^
SyntaxError: invalid syntax
sage: x=[1,2+5,3]
sage: x
[1, 7, 3]
sage: x=[a=1,2+5,3]
------------------------------------------------------------
File "<ipython console>", line 1
x=[a=Integer(1),Integer(2)+Integer(5),Integer(3)]
^
SyntaxError: invalid syntax
sage: x=[a=5, b+=5, c-=3, d*=5, e/=8]
------------------------------------------------------------
File "<ipython console>", line 1
x=[a=Integer(5), b+=Integer(5), c-=Integer(3), d*=Integer(5),
e/=Integer(8)]
^
SyntaxError: invalid syntax
sage:
Obviously is it in Sage not possible to calculate list elements with
an allocation??
Reagrds BB
To prevent some questions: I initiated b,c,d,e in the above example, but
did not copy that!
In Octave (MATLAB) that works ok:
octave:1> x=[a=5,a+=5]
x =
5 10
octave:2>
Maxima does not know that shostcut-operators at all.
SciLab cannot handle this either.
-->x=[a=5,a+=5]
!--error 4
Undefinierte Variable: a
That seems to be a hereditary defect coming from python:
IDLE 2.6.4
>>> x=[a=5, a+= 5]
SyntaxError: invalid syntax
>>> a=5
>>> a+=5
>>> a
10
>>>
I think there is nothing possible to change that?
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org