#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 jdemeyer):

 The error message is consistent with what Python gives:
 {{{
 sage: D = {}
 sage: D[0]
 ---------------------------------------------------------------------------
 KeyError                                  Traceback (most recent call
 last)
 <ipython-input-2-b088d10b34b5> in <module>()
 ----> 1 D[Integer(0)]

 KeyError: 0
 }}}
 so I would close it as "invalid" (not a bug).

 Interestingly, `KeyError` uses the `repr()` of its argument to show the
 exception, while other exceptions use the `str()`, note the extra {{{'}}}
 around the last `0`:
 {{{
 sage: raise ValueError("0")
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)
 <ipython-input-5-eae8cf826a55> in <module>()
 ----> 1 raise ValueError("0")

 ValueError: 0
 sage: raise KeyError("0")
 ---------------------------------------------------------------------------
 KeyError                                  Traceback (most recent call
 last)
 <ipython-input-6-97c3d5eafb80> in <module>()
 ----> 1 raise KeyError("0")

 KeyError: '0'
 }}}

 So I really think that `KeyError` is supposed to take as argument the
 exact key which failed.

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