On Wednesday, April 3, 2019 at 1:56:03 PM UTC-4, John H Palmieri wrote:
>
>
>
> On Wednesday, April 3, 2019 at 10:11:19 AM UTC-7, kcrisman wrote:
>>
>>
>>
>> On Tuesday, April 2, 2019 at 6:03:23 PM UTC-4, Dima Pasechnik wrote:
>>>
>>> On Tue, Apr 2, 2019 at 10:47 PM <dsejas.m...@gmail.com> wrote: 
>>> > 
>>> > Hello, Sage community. 
>>> > With the upcoming migration of Sage from Python2 to Python3, I was 
>>> wondering if the "print" statement will be changed to the new "print" 
>>> function. In any case, will there be backwards compatibility with the 
>>> current behavior? 
>>>
>>> As you can see in the current sage sources, there are no print 
>>> statements left, 
>>> only print functions. 
>>>
>>> the trick with Python 2 is to do 
>>>
>>> from __future__ import print_function 
>>>
>>> to get this compatibility 
>>>
>>
>> I think the post was asking for the reverse compatibility, though. 
>>  Presumably this would be possible (but perhaps not advisable) with adding 
>> something to the preparser.  I would be okay with a preparser addition that 
>> would look for this and say something like "print blah should now be 
>> print(blah)" but raise an error.
>>
>
> Some of this has been discussed at https://trac.sagemath.org/ticket/23674 
> <https://www.google.com/url?q=https%3A%2F%2Ftrac.sagemath.org%2Fticket%2F23674&sa=D&sntz=1&usg=AFQjCNFdgE6J1bhdtV-MF7knFSAl2vXRAA>.
>  
> That ticket should be revived, especially if there is any consensus about 
> how to handle this. I like the idea of deprecating statements like "print 
> x" ASAP.
>
> -- 
> John
>
> +1 for John's suggestion.
I agree that the print statement should be deprecated, not just because the 
print function seems to be a more modern approach, but also because it is 
important for users to have a standard way of printing results in this two 
"sister languages", Python and Sage. Being Sage built on Python, it would 
be a philosophy clash that one uses a print function and the other a print 
statement.
However, I also believe in backwards compatibility, so I would think that 
there should be a way to indicate SageMath to execute a program using 
Python2 conventions. Maybe something like "sage -std=py2 
<script_name.sage>", or even a directive like "#! python2" at the beginning 
of the script. I would also think of a "from standards import python2", or 
a command "guess_estandard()" so that the preparser can automatically take 
care of recognizing Pyhton 2 syntax. There are many ways to deal with this 
matter.
Anyway, how can we revive ticket https://trac.sagemath.org/ticket/23674?

-- 
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.

Reply via email to