nmod_poly previously compared unequal to an integer e.g.
>>> nmod_poly([1], 3) == 1
False
This was inconsistent with all other poly types and also with nmod. The change here makes it so that nmod_poly can compare equal with anything that can be coerced by the nmod constructor.
So an exception is made here for int but comparison with fmpz is not allowed. The change here does the same thing for nmod_poly. It will compare unequal to fmpz_poly but will compare equal to an int or an nmod with the same modulus.
Also renamed all __nonzero__ methods to __bool__ (Python 3 vs 2)
Also added is_one and is_zero to almost all *_poly and *_mpoly types because this was inconsistent before.
The two poly types that I didn't add is_one and is_zero to are arb_poly and acb_poly. I was unsure what the expected behaviour there should be...
Currently fmpz_mod has both is_one and is_zero but all other scalar types do not. I'm not sure whether it makes sense to add them just for overall consistency. No matrix types have is_zero or is_one although there are corresponding Flint functions for this.
nmod_poly previously compared unequal to an integer e.g.
This was inconsistent with all other poly types and also with nmod. The change here makes it so that
nmod_poly
can compare equal with anything that can be coerced by the nmod constructor.We currently have:
So an exception is made here for int but comparison with fmpz is not allowed. The change here does the same thing for nmod_poly. It will compare unequal to fmpz_poly but will compare equal to an int or an nmod with the same modulus.
Also renamed all
__nonzero__
methods to__bool__
(Python 3 vs 2)Also added
is_one
andis_zero
to almost all*_poly
and*_mpoly
types because this was inconsistent before.The two poly types that I didn't add
is_one
andis_zero
to arearb_poly
andacb_poly
. I was unsure what the expected behaviour there should be...Currently
fmpz_mod
has bothis_one
andis_zero
but all other scalar types do not. I'm not sure whether it makes sense to add them just for overall consistency. No matrix types haveis_zero
oris_one
although there are corresponding Flint functions for this.