#16969: Missing error message for WordMorphism
------------------------------------+------------------------
Reporter: nadialafreniere | Owner:
Type: PLEASE CHANGE | Status: new
Priority: major | Milestone: sage-6.4
Component: PLEASE CHANGE | Resolution:
Keywords: error, Words | Merged in:
Authors: Nadia Lafrenière | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
------------------------------------+------------------------
Comment (by slabbe):
I suggested Nadia to create the ticket. For some user the difference
between the str `'0'` and the int `0` is not clear especially since both
of the following have the same repr :
{{{
sage: m = WordMorphism('0->01,1->10'); m
WordMorphism: 0->01, 1->10
sage: m = WordMorphism({0:[0,1],1:[1,0]}); m
WordMorphism: 0->01, 1->10
}}}
The following is fine and I think any user is okay with it:
{{{
sage: m
WordMorphism: 0->01, 1->10
sage: m([4])
Traceback (most recent call last):
...
KeyError: 4
}}}
But suppose you don't remember how `m` was created. You print it and then
you use it:
{{{
sage: m
WordMorphism: 0->01, 1->10
sage: m([0])
Traceback (most recent call last):
...
KeyError: 0
}}}
The first time you get the error, it can be confusing and not easy to find
what is wrong.
I was thinking about a better error message like the following:
{{{
sage: m
WordMorphism: 0->01, 1->10
sage: m([0])
Traceback (most recent call last):
...
KeyError: 0. Valid keys are ['0', '1'].
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/16969#comment:2>
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.