Hi!

On 2012-12-21, Emmanuel Charpentier <emanuel.charpent...@gmail.com> wrote:
> But why do we have to use max_symbolic ? As far as I can tell, max, like=20
> many other functions in Sage, could be overloaded to call max_symbolic when=
> used with a symbolic argument, no ? After all, we don't have to write=20
> plus_symbolic(a,b) instead of a+b...=20

That's a substantial difference, IMHO.

If you do a+b, then Python calls a.__add__(b). So, Python being object
oriented, you can easily overload the a.__add__ method. Sage has the
class sage.structure.element.RingElement, which overloads the
__add__ method, and if you sub-class it, you should in fact implement
_add_ with single underscore.

But max is a Python builtin *function*. Overloading it by something else
would break a lot of things, and I guess performance would suffer, if
you overload max() by a function that first checks whether one of the
arguments is a symbolic expression.

Best regards,
Simon

> ------=_Part_25_22668100.1356102514858
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
>
> Dear Sir,<div><br></div><div>Thank you for your prompt advice. Some comment=
> s below :<br><br>Le vendredi 21 d=E9cembre 2012 15:03:45 UTC+1, kcrisman a =
>=E9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
> eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><blockquote clas=
> s=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc =
> solid;padding-left:1ex"><br>I am in the process of learning Sage, coming fr=
> om Maxima (and Mathematica, which I do not like much...).<div>

() ascii ribbon campaign -- save bandwith
/\ www.asciiribbon.org   -- avoid proprietary attachments

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to