On Thu, Jan 28, 2021 at 8:33 AM Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
>
> I would say, better to avoid it. That is a personal comment.
>
> Vincent
>
> Le 27/01/2021 à 18:48, G. M.-S. a écrit :
> > So if I understand you well, "x in P" should not be used for serious work?
> >
> > Guillermo
> >
> > On Wed, 27 Jan 2021 at 08:55, Vincent Delecroix <20100.delecr...@gmail.com>
> > wrote:
> >
> >> Oups, I forgot to copy all the relevant input
> >>
> >> sage: a = 1.9999999999999999
> >>
> >> Vincent
> >>
> >> Le 26/01/2021 à 19:38, G. M.-S. a écrit :
> >>> Just out of curiosity:  What is "a"?
> >>>
> >>> Guillermo
> >>>
> >>> On Tue, 26 Jan 2021 at 09:29, Vincent Delecroix <
> >> 20100.delecr...@gmail.com>
> >>> wrote:
> >>>>
> >>>> And what should be thought about "4.0 in ZZ" ?
> >>>>
> >>>> Even more fun
> >>>>
> >>>> sage: a in ZZ
> >>>> False
> >>>> sage: 4 / a in ZZ
> >>>> False
> >>>> sage: 4.0 / a in ZZ
> >>>> True
> >>>>
> >>>> Does Sage even have any clear specification for "x in P"?

Certainly. This is just Python:
https://docs.python.org/3/reference/expressions.html#membership-test-operations

Specifically, you can explore how "in" is implemented for a concrete
class P by instpecting

P.__contains__??

E.g. to get an idea about puzzling behaviour of ZZ look at (very short) code in
ZZ.__contains__??

I don't see why you should avoid it. (You can avoid Python/Sage
completely, surely, but this is just Python
code, there is no weird magic there)



> >>>>
> >>>> Concerning input that are of the wrong type, it is common
> >>>> in Python (?) to just throw error
> >>>>
> >>>>    >>> list(range(4))
> >>>> [0, 1, 2, 3]
> >>>>    >>> list(range(4.0))
> >>>> Traceback (most recent call last):
> >>>> ...
> >>>> TypeError: 'float' object cannot be interpreted as an integer
> >>>>
> >>>> Vincent
> >>
> >
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/693740a1-0110-1c28-eeda-a3635b06e36c%40gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq38EKcCzOgyKF8a1CcnfmNK_5BhbKi3MtPnRJmosrdE9g%40mail.gmail.com.

Reply via email to