#4954: Words_over_Alphabet should check the type of input alphabet
---------------------------+------------------------------------------------
 Reporter:  slabbe         |       Owner:  mhansen       
     Type:  defect         |      Status:  new           
 Priority:  major          |   Milestone:  sage-3.4      
Component:  combinatorics  |    Keywords:  words alphabet
---------------------------+------------------------------------------------
 Do

 {{{
 sage: W=Words('ab')
 sage: W.alphabet?
 }}}

 and you get the following help example :

 {{{
 sage: from sage.combinat.words.words import Words_over_Alphabet
 sage: W = Words_over_Alphabet([1,2,3])
 sage: W.alphabet()
 [1, 2, 3]
 sage: from sage.combinat.words.words import OrderedAlphabet
 sage: W = Words_over_Alphabet(OrderedAlphabet('ab'))
 sage: W.alphabet()
 Ordered Alphabet ['a', 'b']
 }}}

 The first of the above example is misleading. In fact, it is not usable :

 {{{
 sage: from sage.combinat.words.words import Words_over_Alphabet
 sage: W = Words_over_Alphabet([1,2,3])
 sage: W.alphabet()
 [1, 2, 3]
 sage: W([1,1,1,2,1,3])
 Traceback (most recent call last):
 ...
 AttributeError: 'list' object has no attribute 'rank'
 }}}

 The problem comes from the fact that Words_over_Alphabet doesn't check the
 input alphabet before asigning it to self._alphabet(). It should either do
 {{{alphabet=OrderedAlphabet(alphabet)}}} before or check the type of the
 input alphabet with a isinstance.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4954>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to