#18578: Python 3 preparation: Special function __div__() is used no more in Py3
-------------------------------+------------------------
       Reporter:  wluebbe      |        Owner:
           Type:  enhancement  |       Status:  new
       Priority:  major        |    Milestone:  sage-6.8
      Component:  misc         |   Resolution:
       Keywords:  python3      |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+------------------------

Comment (by wluebbe):

 To observe the actual code behavior (besides reading the Python docs) I
 created a small test script (see the attached file). A summary of the
 output under various conditions is here:
 {{{
 __div__       is defined
 __truediv__   is defined
 __floordiv__  is defined
 __idiv__      is defined
 __itruediv__  is defined
 __ifloordiv__ is defined

 python version: 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit
 (AMD64)]
 from __future__ import division is NOT active
 function: __div__       115 10 ## operator is /; result=cla(11)
 function: __floordiv__  115 10 ## operator is //; result=cla(11)
 function: __idiv__      215 10 ## operator is /=; result=cla(21)
 function: __ifloordiv__ 215 10 ## operator is //=; result=cla(21)

 Python version: 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit
 (AMD64)]
 from __future__ import division is active
 function: __truediv__   115 10 ## operator is /; result=cla(11.5)
 function: __floordiv__  115 10 ## operator is //; result=cla(11)
 function: __itruediv__  215 10 ## operator is /=; result=cla(21.5)
 function: __ifloordiv__ 215 10 ## operator is //=; result=cla(21)

 Python version: 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC
 v.1600 64 bit (AMD64)]
 from __future__ import division is NOT active
 function: __truediv__   115 10 ## operator is /; result=cla(11.5)
 function: __floordiv__  115 10 ## operator is //; result=cla(11)
 function: __itruediv__  215 10 ## operator is /=; result=cla(21.5)
 function: __ifloordiv__ 215 10 ## operator is //=; result=cla(21)

 Python version: 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC
 v.1600 64 bit (AMD64)]
 from __future__ import division is active
 function: __truediv__   115 10 ## operator is /; result=cla(11.5)
 function: __floordiv__  115 10 ## operator is //; result=cla(11)
 function: __itruediv__  215 10 ## operator is /=; result=cla(21.5)
 function: __ifloordiv__ 215 10 ## operator is //=; result=cla(21)
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18578#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to