Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 1ee252db38ce4e66d6351669d2bc1dcb1afd68f6 1 parent 631cb3d
Sergiu Ivanov authored
8 sympy/categories/baseclasses.py
View
@@ -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
6 sympy/categories/tests/test_baseclasses.py
View
@@ -36,7 +36,7 @@ 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
@@ -44,14 +44,14 @@ def test_morphism():
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")
Please sign in to comment.
Something went wrong with that request. Please try again.