Hi, In short: *label is used by the printing functions but also it is used instead of args in some other functions*
I'm trying to make the printing in physics.quantum.spin less ambiguous. According to the answer I received here http://groups.google.com/group/sympy/msg/3f8d4fe139b1884a it will be useful to add subscript (or something else) to the printed expression. Here is the problem: label is used by the printing functions but also it is used instead of args in some other functions. The printing functions for J?Ket are derived all from KetBase which uses function derived from StateBase which uses function derived from QExpr. My understanding is that the self.args of QExpr should be a list (tuple) of the quantum numbers and other useful sympy symbols that define the mathematical object and label should be a list (tuple) of things that must be printed to screen. So we have the JzKet(1/2,1/2) with args (1/2,1/2) and label (1/2,1/2) being printed as |1/2,1/2>. The problems are: - Some parts of the code use label instead of args to get the quantum numbers (j and m in J?Ket). So I can not have the label ("z",1/2,1/2). I believe that a stricter distinction should be made. - *less important and of topic* The separator "," for the label must be the same for every separation (but can be different from ket to ket). So if I want a better label like |z:1/2,1/2> I can't do it. As it stands (at least for the spin part) QExpr defines label as property in the function "return self.args" and then the code uses label instead of args. I believe it is a bug to use label in this manner because I can not override it to have nicer printing. The default for label is ok: just print all quantum numbers. But for the spin for example I would like to have other info printed. *So am I wrong in proposing:* - Fixing the code where label is used instead of args. - Adding a prefix/title/something field to the label so I can have |usefull_info : q_number_1, q_number_2, ...> printed to screen. That will make the base printing functions more complicated but it will not change the rest of the code. Maybe creating a QuantumLabel class would be useful. also: All the code in quantum that deals with printing (inner product's printer for example) supposes that the rightmost char in the string of Ket will be >. So subscripts are out of the question if they are in the form |foo,bar>_subscript. That is not a problem. I am just noting this assumption that does not seem documented. Regards Stefan -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.