+1 to dynamically generating a suitable docstring if the expression consists only of a single constant. But IMHO it should still make clear that this is a symbolic expression, so every functionality for symbolics still applies. Its just a special symbolic expression that is just a constant.
On Thursday, August 21, 2014 9:18:50 PM UTC+1, Erik Massop wrote: > > On Thu, 21 Aug 2014 09:38:54 -0700 (PDT) > kcrisman <kcri...@gmail.com <javascript:>> wrote: > > > In this class, we don't quite instantiate the nice documentation we > > actually have for TwinPrime > ... > > but instead do > > TwinPrime().expression() > > which gets rid of all that useful info. Same for most such constants, I > > believe, so that they are in the symbolic ring/Ginac. > > > > Does anyone have a quick way to fix this? (Maybe even by getting rid of > > .expression() ?) I have wondered about this too but I knew what the > twin > > prime constant was so I didn't run into it... but of course Nathann is > > right that this is not that helpful currently. > > The quickest fix is probably writing in the documentation of > sage.symbolic.expression.Expression that the user should maybe try > sage: tmp = expression.pyobject() > sage: tmp? > for some more useful information. > > Here's what the result would be for twinprime: > > sage: tmp = twinprime.pyobject() > sage: tmp? > Type: TwinPrime > String form: twinprime > File: > /home/erik/sage/local/lib/python2.7/site-packages/sage/symbolic/constants.py > > Docstring: > The Twin Primes constant is defined as prod 1 - 1/(p-1)^2 for > primes p > 2. > > EXAMPLES: > > sage: float(twinprime) > 0.6601618158468696 > sage: twinprime.n(digits=60) > 0.660161815846869573927812110014555778432623360284733413319448 > > Init docstring: > EXAMPLES: > > sage: loads(dumps(twinprime)) > twinprime > > > The docstring of sage.symbolic.expression.Expression-objects could also > be dynamically generated. This is done as a proof of concept in the > attached patch. Recursing in docstring generation is maybe not so nice > though. Also you still get the nasty Init and Call documentation from > Expression. The cleanest solution from a docstring-perspective is > probably getting rid of expression(). > > Is there a ticket for this? > > > Regards, > > Erik Massop > -- 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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.