Opened 7 years ago

Last modified 6 years ago

#17150 new enhancement

Proper syntax for creating morphism

Reported by: SimonKing Owned by:
Priority: major Milestone: sage-6.4
Component: coercion Keywords:
Cc: nthiery, jpflori Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #10668 Stopgaps:

Status badges


Currently (and even with #10668), there is a generic call method for homsets that is not really useful, as it does not make any use of element classes or other ingredients of the "usual" framework for making a parent callable. In particular, homsets typically override __call__, which means that we can not benefit from a generic coercion model.

This ticket aims at providing a generic call method for homsets (similarly to what we have for parents) and use it in all concrete implementations of homsets.

Change History (2)

comment:1 Changed 7 years ago by SimonKing

A comment from #10668, what Nicolas would like to have:

For A a parent, A.hom(on_basis = [data],...) would call A.morphism_on_basis(data,...). This morphism_on_basis could typically be implemented in A, or in C.ParentMethods for C the category of A.

There are 5-6 explicit hom functions in Sage that would need to be generalized to accept this syntax, while keeping backward compatibility if no keyword is specified.

I am not totally sure whether I would like that change. The A.hom(data, B) method should, in my opinion, be a short-cut for A.Hom(B)(data), and it should be the responsibility of the homset to process the data (by means of _element_constructor_). I would like to have everything as close to what we have for parents as possible. So, _element_constructor_ and friends should be used.

comment:2 Changed 6 years ago by jpflori

  • Cc jpflori added
Note: See TracTickets for help on using tickets.