#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 nthiery):

 Replying to [comment:467 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.

 See [comment:464]. One wants to be incremental in most cases
 anyway. The only thing is that the infrastructure currently forces to
 be incremental by unit steps.

 > Replying to [comment:464 nthiery]:
 > > Well, yes: there is no standard mixin mechanism in Python
 >
 > There is, multiple inheritance.

 Well, that's for static mixin. And indeed you can use multiple
 inheritance together with dynamic classes to implement dynamic mixins
 which are gathered dynamically as we need. But there is no standard
 implementation and syntax for dynamic mixins.

 > > 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...

 No, no, you got me wrong. I meant that I certainly agreed with that
 train: in such a general situation that would have been horribly
 implicit.

 > > {{{
 > >     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 ;-)

 Well, of course I would frown upon a large deeply nested class,
 because of indentation; it's certainly better to put such a class in a
 separate file. But in a case like above, it's concise and very
 expressive.

 I believe nested classes are an *opportunity* given to us by Python to
 structure the code; it just has been under-exploited yet.

--
Ticket URL: <http://trac.sagemath.org/ticket/10963#comment:470>
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.

Reply via email to