I discovered a small bug in sage 2.4.2 in the handling of maxima
lists.
When iterating over a maxima list there is an off by one error.
Individual
item access works fine.
I think the bug is actually in the implementation of
ExpectElement.__iter__
which strangely starts iterating from 1!
Michel
================ Example =======================
sage: v = maxima('create_list(i*x^i,i,0,5)') #exampe from manual.
sage: for i in v:
print i
....:
x
2*x^2
3*x^3
4*x^4
5*x^5
---------------------------------------------------------------------------
<type 'exceptions.IndexError'> Traceback (most recent call
last)
/home/vdbergh/<ipython console> in <module>()
//usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/
expect.py in __iter__(self)
735 def __iter__(self):
736 for i in range(1, len(self)+1):
--> 737 yield self[i]
738
739 def __len__(self):
//usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/
maxima.py in __getitem__(self, n)
1323 n = int(n)
1324 if n < 0 or n >= len(self):
-> 1325 raise IndexError, "n = (%s) must be between %s and
%s"%(n, 0, len(self)-1)
1326 return ExpectElement.__getitem__(self, n+1)
1327
<type 'exceptions.IndexError'>: n = (6) must be between 0 and 5
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
sage-devel-unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---
|