#16086: Python 3 preparation: Py2 vs. Py3 return value of write() in doctests
--------------------------------+------------------------
       Reporter:  wluebbe       |        Owner:
           Type:  enhancement   |       Status:  new
       Priority:  major         |    Milestone:  sage-6.2
      Component:  distribution  |   Resolution:
       Keywords:  python3       |    Merged in:
        Authors:                |    Reviewers:
Report Upstream:  N/A           |  Work issues:
         Branch:                |       Commit:
   Dependencies:                |     Stopgaps:
--------------------------------+------------------------
Description changed by wluebbe:

Old description:

> The write() function does return nothing in Py2
> {{{
> >>> sys.version
> '2.7.5+ (default, Feb 27 2014, 19:37:08) \n[GCC 4.8.1]'
> >>> with open("tracked", "w") as f: f.write("boo")
> ...
> >>>
> }}}
> while in Py3 it returns the number of bytes written
> {{{
> >>> sys.version
> '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]'
> >>> with open("tracked", "w") as f: f.write("boo")
> ...
> 3
> >>>
> }}}
> This can be unified by adding something like {{{ignore =}}}
> {{{
> >>> sys.version
> '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]'
> >>> with open("tracked", "w") as f: ignore = f.write("boo")
> ...
> >>>
> }}}
> About 79 py module are effected.

New description:

 The write() function does return nothing in Py2
 {{{
 >>> sys.version
 '2.7.5+ (default, Feb 27 2014, 19:37:08) \n[GCC 4.8.1]'
 >>> with open("tracked", "w") as f: f.write("boo")
 ...
 >>>
 }}}
 while in Py3 it returns the number of bytes written
 {{{
 >>> sys.version
 '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]'
 >>> with open("tracked", "w") as f: f.write("boo")
 ...
 3
 >>>
 }}}
 This can be unified by adding something like {{{ignore =}}}
 {{{
 >>> sys.version
 '3.3.2+ (default, Feb 28 2014, 00:52:16) \n[GCC 4.8.1]'
 >>> with open("tracked", "w") as f: ignore = f.write("boo")
 ...
 >>>
 }}}
 About 79 py module are effected.

 This ticket is tracked as a dependency of meta-ticket ticket:16052.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/16086#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