summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2016-05-06 16:09:12 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2016-05-06 16:09:12 +0200
commit9ec7d3e4d636676e7091f6e7032f274853677418 (patch)
tree6828d14bb2a6ccc103954c3be9f0d5f9631fe9b8
parentMerge branch 'public/manifolds/top_manif_scalar_fields' of git://trac.sagemat... (diff)
Python 3 format for print in manifoldspublic/manifolds/top_manif_scalar_fields
-rw-r--r--src/sage/manifolds/chart.py8
-rw-r--r--src/sage/manifolds/manifold.py44
2 files changed, 23 insertions, 29 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 7e1610b..63b583a 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -1209,8 +1209,8 @@ class RealChart(Chart):
Coordinate are also accessible by their indices::
sage: x1 = c_spher[1]; x2 = c_spher[2]; x3 = c_spher[3]
- sage: print x1, x2, x3
- r th ph
+ sage: [x1, x2, x3]
+ [r, th, ph]
sage: (x1, x2, x3) == (r, th, ph)
True
@@ -2152,8 +2152,8 @@ class CoordChange(SageObject):
raise ValueError("no solution found; use set_inverse() to " +
"set the inverse manually")
if len(list_x2_to_x1) > 1:
- print "Multiple solutions found: "
- print list_x2_to_x1
+ print("Multiple solutions found: ")
+ print(list_x2_to_x1)
raise ValueError(
"non-unique solution to the inverse coordinate " +
"transformation; use set_inverse() to set the inverse " +
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index c5cbcc4..c2b33fc 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -1110,28 +1110,20 @@ class TopologicalManifold(ManifoldSubset):
Index range on a 4-dimensional manifold::
sage: M = Manifold(4, 'M', structure='topological')
- sage: for i in M.irange():
- ....: print i,
- ....:
- 0 1 2 3
- sage: for i in M.irange(2):
- ....: print i,
- ....:
- 2 3
+ sage: [i for i in M.irange()]
+ [0, 1, 2, 3]
+ sage: [i for i in M.irange(2)]
+ [2, 3]
sage: list(M.irange())
[0, 1, 2, 3]
Index range on a 4-dimensional manifold with starting index=1::
sage: M = Manifold(4, 'M', structure='topological', start_index=1)
- sage: for i in M.irange():
- ....: print i,
- ....:
- 1 2 3 4
- sage: for i in M.irange(2):
- ....: print i,
- ....:
- 2 3 4
+ sage: [i for i in M.irange()]
+ [1, 2, 3, 4]
+ sage: [i for i in M.irange(2)]
+ [2, 3, 4]
In general, one has always::
@@ -1168,7 +1160,7 @@ class TopologicalManifold(ManifoldSubset):
sage: M = Manifold(2, 'M', structure='topological', start_index=1)
sage: for ind in M.index_generator(2):
- ....: print ind
+ ....: print(ind)
....:
(1, 1)
(1, 2)
@@ -1178,15 +1170,17 @@ class TopologicalManifold(ManifoldSubset):
Loops can be nested::
sage: for ind1 in M.index_generator(2):
- ....: print ind1, " : ",
- ....: for ind2 in M.index_generator(2):
- ....: print ind2,
- ....: print ""
+ ....: print("{} : ".format(ind1))
+ ....: [ind2 for ind2 in M.index_generator(2)]
....:
- (1, 1) : (1, 1) (1, 2) (2, 1) (2, 2)
- (1, 2) : (1, 1) (1, 2) (2, 1) (2, 2)
- (2, 1) : (1, 1) (1, 2) (2, 1) (2, 2)
- (2, 2) : (1, 1) (1, 2) (2, 1) (2, 2)
+ (1, 1) :
+ [(1, 1), (1, 2), (2, 1), (2, 2)]
+ (1, 2) :
+ [(1, 1), (1, 2), (2, 1), (2, 2)]
+ (2, 1) :
+ [(1, 1), (1, 2), (2, 1), (2, 2)]
+ (2, 2) :
+ [(1, 1), (1, 2), (2, 1), (2, 2)]
"""
si = self._sindex