Hi, I was trying to learn a bit of weave, but there seems to be some problem. The code I used is
import scipy.weave as weave a, b = 10, 5 code = \ ''' int temp; temp = a; a = b; b = temp; ''' weave.inline(code, ['a', 'b']) print a, b When I ran this code in sage notebook, I got the following error Traceback (most recent call last): print a, b File "/home/rajeev/bin/sage-4.2/local/lib/python2.6/site-packages/ scipy/weave/inline_tools.py", line 321, in inline results = attempt_function_call(code,local_dict,global_dict) File "/home/rajeev/bin/sage-4.2/local/lib/python2.6/site-packages/ scipy/weave/inline_tools.py", line 389, in attempt_function_call function_list = function_catalog.get_functions(code,module_dir) File "/home/rajeev/bin/sage-4.2/local/lib/python2.6/site-packages/ scipy/weave/catalog.py", line 612, in get_functions function_list = self.get_cataloged_functions(code) File "/home/rajeev/bin/sage-4.2/local/lib/python2.6/site-packages/ scipy/weave/catalog.py", line 526, in get_cataloged_functions if cat is not None and code in cat: File "/home/rajeev/bin/sage-4.2/local/lib/python/shelve.py", line 110, in __contains__ return key in self.dict File "/home/rajeev/bin/sage-4.2/local/lib/python2.6/site-packages/ scipy/io/dumbdbm_patched.py", line 73, in __getitem__ pos, siz = self._index[key] # may raise KeyError KeyError: 0 The same code runs in python, but doesn't do what I want it to do, i.e. interchange the values of a and b. I think this is due to 'call by value' but I am not sure. I hope its OK to ask this question here. Best wishes, Rajeev -- 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