On Nov 2, 12:08 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Nov 1, 11:30 pm, "Justin C. Walker" <[EMAIL PROTECTED]> wrote:
>
> > Changing "^" to "**" would improve the consistency, not the
> > inconsistency :-}
>
> > I know what you mean, but I think we're wedded to the difference.
>
> What about if Sage modified Python syntax slightly?
> For example, what if Sage added pre-processing code to replace "^"
> with "**" before feeding the Sage/Python code to the Python
> interpreter?
Sage already does that via its preparser:
sage: x^2
x^2
sage: x**2
x^2
sage: preparse("x^2")
'x**Integer(2)'
I.e.. any time you there is a "^" in input it is replaced by "**". You
can turn the preparser off and then use "^" to signify XOR.
> This would mean that Sage coders could use "^" everywhere including in
> Python code.
> Then Sage could allow both "^" and "**" everywhere.
>
> e.g.
>
> def my_sage_square_function(x):
> return x^2
>
> One potential problem I can forsee with this is if someone really
> wanted to do XOR in Sage/Python code. But even in that case they
> could use alternatives.
>
> Chris
Cheers,
Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---