On Wed, 2 Mar 2011 06:09:30 -0800 (PST) Simon King <simon.k...@uni-jena.de> wrote:
> On 2 Mrz., 14:33, Florent Hivert <florent.hiv...@univ-rouen.fr> wrote: > > Wouldn't be better to raise an error ? Note that I can also write: > > > > sage: cos([]) = [] > > The preparser does > sage: preparse("parent([]) = []") > '__tmp__=var("[]"); parent = symbolic_expression([]).function([])' > > I find it a bit strange that var(...) accepts input that is not an > alpha-numeric string. > > For what reason is var(s) not raising an error if not s.isalnum()? People might want to use utf-8 strings which won't be valid under that condition. See #7496: http://trac.sagemath.org/sage_trac/ticket/7496 > And: Why is var(...) accepting arguments that are not strings, and > transforms them into a string by means of repr(...)? > By consequence, we have > sage: var(singular) > Singular > and > sage: var(QQ) > (Rational, Field) > sage: var(QQ['t']) > (Univariate, Polynomial, Ring, in, t, over, Rational, Field) > > I think var(QQ['t']) not resulting in an error but returning eight > variables is shocking. I agree that we should be more strict. It should be enough to change the lines if not isinstance(name, str): name = repr(name) in sage.symbolic.ring.SR.var(). Cheers, Burcin -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org