The reason that a==0 returns false is that there is no coercion map from QQ to P:
sage: P.has_coerce_map_from(QQ) False I'm not convinced that there should be a coercion, it's pretty rare that a scheme has a natural map from its base ring. However, it seems like there's also a problem hiding here, probably because schemes don't use the coercion model properly: sage: P.convert_map_from(QQ) Traceback (most recent call last) ... RuntimeError: BUG in coercion model, no element constructor for <class 'sage.schemes.projective.projective_space.ProjectiveSpace_rational_field_with_category'> David On Thu, Sep 7, 2017 at 1:11 PM, Ben Hutz <bn4...@gmail.com> wrote: > I'm working on implementing coercion for scheme points and had a question > about how comparison is done. As an explicit example consider the following > point > > P.<u,v>= ProjectiveSpace (QQ ,1) > a=P(0) > > in particular, the integer 0 is coerced into the projective point (0:1). > For comparisons it appears that > > a == P(0) (returns to True) > > calls the _richcmp_() function so uses the coercion framework, but > > a==0 (returns False even though it knows there is a coercion from the > integer ring to P) > > is calling something else. There does not appear to be an __eq__() > operator implemented for scheme points, but it does show up in tab > completion in the notebook, but can't tell me where the code is from. Is > this an artifact of starting to transition the code to python3. Or this > just broken somewhere? > > Thanks, > Ben > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.