| 1 | initial version |
Sage provides some functions with the same names as some Python built-in functions.
In the case of sum it tries to be unobtrusive,
as @Emmanuel Charpentier's answer explains.
To force the use of Python's sum:
sage: from builtins import sum as python_sum
sage: python_sum([3, 4, 5])
12
To check where the currently active sum is from:
sage: import_statements(sum)
from sage.misc.functional import symbolic_sum
To have sum be Python's and symbolic_sum be Sage's:
sage: from builtins import sum
sage: from sage.misc.functional import symbolic_sum
To use symbolic_sum as sage_sum:
sage: from sage.misc.functional import symbolic_sum as sage_sum
| 2 | No.2 Revision |
Sage provides some functions with the same names as some Python built-in functions.
In the case of sum it tries to be unobtrusive,
as @Emmanuel Charpentier's answer explains.
To force the use of Python's sum:
sage: from builtins import sum as python_sum
sage: python_sum([3, 4, 5])
12
To check where the currently active sum is from:
sage: import_statements(sum)
from sage.misc.functional import symbolic_sum
To have sum be Python's and symbolic_sum be Sage's:
sage: from builtins import sum
sage: from sage.misc.functional import symbolic_sum
To use symbolic_sum as sage_sum:
sage: from sage.misc.functional import symbolic_sum as sage_sum
The documentation could be improved on this topic. See the dedicated ticket:
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.