# HG changeset patch
# User William Stein <wstein@gmail.com>
# Date 1224818339 25200
# Node ID ca698143915dd2418a4bb0473ea8cf01711963e0
# Parent 052c08ccac80b0e102df5ab8fa735fb64df31b9a
trac #2171 -- (magma/sage interface) some further optimizations and fixes (part 2)
diff -r 052c08ccac80 -r ca698143915d sage/interfaces/expect.py
a
|
b
|
|
1087 | 1087 | return self.eval(var) |
1088 | 1088 | |
1089 | 1089 | def get_using_file(self, var): |
1090 | | """ |
1091 | | Return the string representation of the variable var in self |
1092 | | using a file. Use this if var has a huge string |
1093 | | representation. It'll be way faster. |
| 1090 | r""" |
| 1091 | Return the string representation of the variable var in self, |
| 1092 | possibly using a file. Use this if var has a huge string |
| 1093 | representation, since it may be way faster. |
| 1094 | |
| 1095 | WARNING: In fact unless a special derived class implements |
| 1096 | this, it will \emph{not} be any faster. This is the case for |
| 1097 | this class if you're reading it through introspection and |
| 1098 | seeing this. |
1094 | 1099 | """ |
1095 | 1100 | return self.get(var) |
1096 | 1101 | |
diff -r 052c08ccac80 -r ca698143915d sage/interfaces/magma.py
a
|
b
|
|
1158 | 1158 | [1 2 3] |
1159 | 1159 | [4 5 6] |
1160 | 1160 | """ |
1161 | | P = self._check_valid() |
1162 | | cmd = "Sage(%s)"%self.name() |
1163 | | s = str(P.eval(cmd)) |
1164 | | return sage.misc.sage_eval.sage_eval(s) |
| 1161 | z, preparse = self.Sage(nvals = 2) |
| 1162 | s = str(z) |
| 1163 | preparse = str(preparse) == 'true' |
| 1164 | return sage.misc.sage_eval.sage_eval(s, preparse=preparse) |
1165 | 1165 | |
1166 | 1166 | def AssignNames(self, names): |
1167 | 1167 | """ |
diff -r 052c08ccac80 -r ca698143915d sage/misc/sage_eval.py
a
|
b
|
|
19 | 19 | Sage. This means calling eval after preparsing and with |
20 | 20 | globals equal to everything included in the scope of |
21 | 21 | \code{from sage.all import *}.). |
| 22 | |
| 23 | INPUT: |
| 24 | source -- a string or object with a _sage_ method |
| 25 | locals -- evaluate in namespace of sage.all plus the |
| 26 | locals dictionary |
| 27 | cmds -- string; sequence of commands to be run before |
| 28 | source is evaluated. |
| 29 | preparse -- (default: True) if True, preparse the |
| 30 | string expression. |
| 31 | |
22 | 32 | |
23 | 33 | EXAMPLES: |
24 | 34 | This example illustrates that preparsing is applied. |