On Fri, Jun 20, 2008 at 05:30:29AM -0700, Pearu Peterson wrote:
> 
> 
> 
> On Jun 20, 11:42 am, "Ondrej Certik" <[EMAIL PROTECTED]> wrote:
> > >> Also, let's get rid of set_repr_level()? This is quite an important
> > >> change, so I'd like to hear opinions of others as well.
> >
> > > We already had this discussion in the past:
> >
> > >http://code.google.com/p/sympy/issues/detail?id=697
> >
> > > And I think repr(x) should be "Symbol('x')", str(x) should be "x" and
> > > there should be no Basic.set_repr_level.
> >
> > Agree. So you mean this, right Kirill?
> >
> > >>> repr(x**2/2)
> >
> > Mul(Half(1, 2), Pow(Symbol('x'), Integer(2)))

Yes, exactly.

> There is a problem with this representation - it will
> be implementation dependent (say, one will change
> the Half to something else like Rational).

I don't think there is a problem that repr is implementation dependent --
in fact repr is usually used for debugging and it is more convenient
that it'll tell us what exactly some symbolic tree is.

So, if repr says there is a Half - I think it is good that we could
distinguish it from some Rational.

> Another solution to the repr probelm is to return
> 
>   sympify('x**2/2')
> 
> that will satisfy the basic assumption behind repr:
> 
>   eval(repr(obj)) == obj
> 
> (assuming that the parser works correctly) and
> is well readable.

I think we could have

  eval(repr(obj)) == obj

with the above approach too.

At present

  eval('Half')

produces NameError, but I think this should be fixed.


----

I'm for:

  >>> repr(x**2/2)

  Mul(Half(1, 2), Pow(Symbol('x'), Integer(2)))

-- 
    Всего хорошего, Кирилл.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to