Permalink
Browse files

When composing morphisms, intersperse morphism names with '*'.

The initial approach to use spaces to separate morphisms names proved
inconsistent with the later idea to use '*' when printing morphism
composition.
  • Loading branch information...
1 parent 631cb3d commit 1ee252db38ce4e66d6351669d2bc1dcb1afd68f6 @scolobb committed Jun 2, 2012
Showing with 7 additions and 7 deletions.
  1. +4 −4 sympy/categories/baseclasses.py
  2. +3 −3 sympy/categories/tests/test_baseclasses.py
View
8 sympy/categories/baseclasses.py
@@ -56,7 +56,7 @@ def compose(self, g, new_name=""):
If new_name is not an empty string, the new morphism will have
the name new_name. Otherwise the name of the new morphism
will the juxtaposition of the names of morphisms in the
- components list, in reversed order.
+ components list, in reversed order, interspersed with '*'.
Examples
========
@@ -70,7 +70,7 @@ def compose(self, g, new_name=""):
if not new_name:
for component in reversed(composite.components):
- composite.name += component.name + " "
+ composite.name += component.name + "*"
composite.name = composite.name[:-1]
return composite
@@ -101,7 +101,7 @@ def flatten(self, new_name=""):
If new_name is not an empty string, the new morphism will have
the name new_name. Otherwise the name of the new morphism
will be the juxtaposition of the names of morphisms in
- self.components, in reversed order.
+ self.components, in reversed order, interspersed with *.
Examples
========
@@ -115,7 +115,7 @@ def flatten(self, new_name=""):
if not new_name:
for component in reversed(self.components):
- flattened.name += component.name + " "
+ flattened.name += component.name + "*"
flattened.name = flattened.name[:-1]
return flattened
View
6 sympy/categories/tests/test_baseclasses.py
@@ -36,22 +36,22 @@ def test_morphism():
assert k.domain == A
assert k.codomain == C
- assert k.name == "g f"
+ assert k.name == "g*f"
assert k.components == [f, g]
assert h * k == u
assert p * f == u
assert u.domain == A
assert u.codomain == D
- assert u.name == "h g f"
+ assert u.name == "h*g*f"
assert u.components == [f, g, h]
u1 = u.flatten()
assert u1.domain == A
assert u1.codomain == D
- assert u1.name == "h g f"
+ assert u1.name == "h*g*f"
assert u1.components == [u1]
u1 = u.flatten("u")

0 comments on commit 1ee252d

Please sign in to comment.