#17013: WordDatatype_char
-------------------------+-------------------------------------------------
Reporter: | Owner:
vdelecroix | Status: needs_work
Type: | Milestone: sage-6.4
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers: Sébastien Labbé, Jeroen Demeyer
combinatorics | Work issues:
Keywords: words | Commit:
Authors: | a563343267f1690d74275ad3835cdebef8512a19
Vincent Delecroix | Stopgaps:
Report Upstream: N/A |
Branch: |
u/slabbe/17013 |
Dependencies: |
-------------------------+-------------------------------------------------
Changes (by jdemeyer):
* status: positive_review => needs_work
* reviewer: Sébastien Labbé => Sébastien Labbé, Jeroen Demeyer
Comment:
This is absolutely not the right way to handle exceptions:
{{{
if PySlice_GetIndicesEx(...) < 0:
return
}}}
The fact that it "works" is because IPython picks up the exception much
later than you intended. Note the botched traceback:
{{{
sage: Words([0,1,2,3])([0,1,0,2,0,3,1,2,3])[slice("foo")]
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
TypeError: slice indices must be integers or None or have an __index__
method
}}}
The right way is to declare your function as `except -1` and let Cython do
the right thing. See
http://docs.cython.org/src/userguide/language_basics.html#error-return-
values
--
Ticket URL: <http://trac.sagemath.org/ticket/17013#comment:12>
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.