#15923: Incorrect TypeError in FiniteStateMachine.add_from_transition_function
-------------------------------------+-------------------------------------
Reporter: cheuberg | Owner:
Type: defect | Status: new
Priority: minor | Milestone: sage-6.2
Component: combinatorics | Keywords:
Merged in: | finite_state_machine
Reviewers: | Authors: Clemens
Work issues: | Heuberger, Daniel Krenn
Commit: | Report Upstream: N/A
3c3589ac31d2fb509f7e4e1f91a22d961403b01a| Branch:
Stopgaps: |
u/cheuberg/fsm/add_from_transition_function
| Dependencies:
-------------------------------------+-------------------------------------
A TypeError occurring in the callback function
{{{sage.combinat.finite_state_machine.FiniteStateMachine.add_from_transition_function}}}
is incorrectly caught and leads to a misleading ValueError.
Old behaviour:
{{{
sage: def transition(state, where):
sage: ... return (vector([0,0]),1)
sage: Transducer(transition, input_alphabet=[0], initial_states=[0])
Traceback (click to the left of this block for traceback)
...
ValueError: The callback function for add_from_transition is expected
to
return a pair (new_state, output_label) or a list of such pairs. For
the
state 0 and the input letter 0, it however returned [((0, 0), 1)],
which
is not acceptable.
}}}
New behaviour:
{{{
sage: def transition(state, where):
sage: ... return (vector([0,0]),1)
sage: Transducer(transition, input_alphabet=[0], initial_states=[0])
Traceback (click to the left of this block for traceback)
...
TypeError: mutable vectors are unhashable
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15923>
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.