Dear Vincent,

On 2012-08-16, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> It breaks many test in sage.combinat.*. Note that if we adopt the
> strict convention (ie int(2) not in Integers/IntegerRange/...) then it
> will be impossible to do the following
> {{{
> sage: W = Words("positive integers")
> sage: W([int(1), int(2)])
> word: 12
> }}}
>
> I have two options
>   * modify all files in sage.combinat.* in order to fit the new implementation
>   * make PositiveIntegers and IntegerRange accepts silently Python int

The default behaviour of "x in P" for any parent P in Sage is:
 x in P
 <=>
 P(x)==x is True (and does not raise an error)

Hence, according to the default, if P=PositiveIntegers(), then we want
the following:

 1) P(int(1)) works
 2) Coercion between P and int works (this is implicitly used in "==")

But currently, we have:
 * P(int(1)) raises an error (hence, "int(1) in P" is false by default)
 * P(1).parent() is ZZ, not P
 * sage.categories.pushout.pushout(P,ZZ) raises an error.
 * The coercion model finds that there is a multiplication action of
   P on ZZ, but it is not able to tell about addition.

I think that's a mess. P should at least know that it is a subset of ZZ.
Hence, its embedding into ZZ should be registered as a coercion. And it
should be able to convert a positive python int.

Cheers,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to