Hi all there in the Sympy group,
I am a student who have recently started to understand the Sympy code. From the advanced expression manipulation section in the tutorial, it is stated that basically all expressions in Sympy have got func and args attributes with which the object can be reconstructed, like in the Basic class, the copy method is defined in this way. But something that looks very curious to me is that for several typical sympy classes, like Add, Mul, and Symbol, it seems hat I cannot find the place where these two important attributes are set... For example, Add does not come with a __new__ method, I guess it is going to inherit the method from AssocOp, whose __new__ essentially delegated the work to cls._from_args. It seems that Add does not provide an override for this _from_args method, so maybe the _from_args of AssocOp is going to be invoked. But this method just used the __new__ method that is in the super class of AssocOp. It looks like AssocOp only have got one level of super class in Sympy, the Basic class, whose constructor sets the _args attribute but not for the func and args attribute. Since pdb does not seem to provide a feature like watch in gdb, I am very confused and curious where these two important attributes are actually set in the code. Any hint is deeply appreciated. Thank you so much!
Regards,
Tschijnmo