Hi Niles,

On 28 Nov., 23:49, Niles <nil...@gmail.com> wrote:
> I've noticed the following strange behavior (bug):
>
> sage: A.<a> = PolynomialRing(QQ)
> sage: 3 in A
> True
>
> sage: A2.<a,b> = PolynomialRing(QQ)
> sage: 3 in A2
> False
>
> So apparently "in" for multivariate polynomial rings is slightly
> broken, but I don't know where to look to fix it.  I did spend some
> time looking for documentation or previous email threads, but "in"
> makes for a tough search.

I remember that someone has explained to me that membership testing is
specified in Sage as
  e in P  <=>   e==P(e)
where e==P(e) means in particular that no error is raised.

However, as your example demonstrates, that specification is not
always used.

IIRC, this default implementation of the __contains__ could be
inherited from the class sage.structure.parent.Parent

Cheers,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to