Am Mittwoch, 13. Januar 2016 21:57:00 UTC+1 schrieb John H Palmieri: > > > > On Wednesday, January 13, 2016 at 12:43:25 PM UTC-8, Martin R wrote: >> >> To understand the difference between ‘is’ and ‘==‘ may require some >>> background in programming. >>> >>> Specifically, “a==b” evaluates to “True” if the objects ‘a’ and ‘b’ >>> “evaluate to the same *value*”, while “a is b” evaluates to “True” if the >>> objects ‘a’ and ‘b’ *are the same” (i.e., are located at the same locations >>> in RAM). >>> >>> Yes, I understand this. (and to make sure, I checked the python doc) >> >> To answer your questions, your impression is not correct (but you are not >>> alone), and the code is not misleading (making the rash assumption that it >>> is correct, which I have not verified). >>> >>> Now I do not understand. FormalSums inherits from UniqueRepresentation. >> > > "FormalSums" inherits from UniqueRepresentation. "FormalSum" does not, as > far as I can tell. So for instances of FormalSum, which are what arise in > the snippet you posted, "==" may not be the same as "is". > > Now I am entirely confused. I read:
if isinstance(x, FormalSum): P = x.parent() I would think that P is now an instance of "FormalSums", not an instance of "FormalSum"? -- 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.