#18217: Various Cython code fixes
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.7
      Component:  cython             |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jdemeyer/various_cython_code_fixes|  
e86d27196b9cee5e2d53c282a51f401e2a00182a
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by jdemeyer):

 Replying to [comment:6 tscrim]:
 > I don't quite understand this change:
 > {{{#!diff
 > -    return 0
 > }}}
 > Doesn't the `c_sage_inputhook` function need to return an integer (and
 be `0` indicating no error)?

 When a Python function always returns `None`, you usually don't put an
 explicit `return None` at the end either. This function ''always'' returns
 0, so why write it explicitly? The only reason why the return value is
 `int` is for exception handling. Mentally, this function should really be
 `void c_sage_inputhook()`.

 Side comment: I once asked Cython upstream to include a new type for
 situations like these (`vint` would be a good name, for `void + int`,
 analogous to `bint` for `bool + int`), but they didn't like that.

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