#10963: More functorial constructions
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: stumpc5
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.1
Component: categories | Resolution:
Keywords: days54 | Merged in:
Authors: Nicolas M. Thiéry | Reviewers: Simon King, Frédéric
Report Upstream: N/A | Chapoton
Branch: | Work issues:
public/ticket/10963 | Commit:
Dependencies: #11224, #8327, | eb7b486c6fecac296052f980788e15e2ad1b59e4
#10193, #12895, #14516, #14722, | Stopgaps:
#13589, #14471, #15069, #15094, |
#11688, #13394, #15150, #15506 |
-------------------------------------+-------------------------------------
Comment (by vbraun):
Nathan raises a point that confuses me, too. Why is there a single
defining axiom, the self._axiom attribute? It would be much more natural
to have a list of defining axioms. For much of the work you are only
looking at the list of implied `axioms()` anyways.
Replying to [comment:464 nthiery]:
> Well, yes: there is no standard mixin mechanism in Python
There is, multiple inheritance.
> And I would have definitely voted against it :-)
You are of course entitled to your own opinion, but if you want to write a
Python library that others can use then "explicit is better than implicit"
is not up for vote. That train has long departed...
> {{{
> class AdditiveAssociative(CategoryWithAxiom):
> class AdditiveCommutative(CategoryWithAxiom):
> class AdditiveUnital(CategoryWithAxiom):
> class AdditiveInverse(CategoryWithAxiom):
> Associative = LazyImport('sage.categories.rngs',
'Rngs', at_startup=True)
> }}}
And I hope we can all agree that five-fold nested classes are an
abomination ;-)
Replying to [comment:462 SimonKing]:
> How could such syntax look like? Of course, we can have a separate class
`ABs`, and then let both `As.B` and `Bs.A` point to it. But even when you
write down the name `ABs`, you already have a choice to do---after all,
why don't you chose `BAs` instead of `ABs`.
This is just a naming choice, it does not change the actual code (unless
you go out of your way to make the code depend on the class name). You can
even call it `Both_A_and_B`, or `_Implementation` if you want to stress
the symmetry. It doesn't require you to nest class definitions.
--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:467>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.