Sage uses a preparer to translate things like R.<X>=QQ[] into usual Python R=PolynomialRing(...).
In the library code the preparer is not used. On Mon, 19 Nov 2018 03:13 Kolen Cheung <christian.ko...@gmail.com wrote: > Hi, I’m trying to translate this Sage syntax to Python syntax (i.e. using > sage as a Python library.) But I got stuck even on the first command. > > In Sage, > > >>> R.<x> = QQ[]>>> type(R) > > <class > 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category'> > > Then I thought I can import it in Python like this: > > import sage.rings > # OK > > sage.rings.polynomial.polynomial_ring.PolynomialRing_field > # AttributeError > > sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category > > How would you write the same program in Python using sage as a library? > And in general I see many unfamiliar syntax (from Python’s point of view) > like R.<x>, QQ[], (0..20), etc. Do you think it is realistic to use sage > as a Python library and completely not using sage (as an interpreter) > itself? > > c.f. Documentation on using sage as a library? > <https://groups.google.com/d/msg/sage-support/NFtI5XqjQWg/qsW54OzeAQAJ> > > Thanks. > > > -- > 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 post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.