#19619: Simplify words.py
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  combinatorics      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:  Sébastien Labbé
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/19619                 |  13e989e3ab16bcda4980b69d7f6afd65ab46b318
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by slabbe):

 I would prefer if the code of `FiniteOrInfiniteWords.__call__` be like the
 others `FiniteWords.__call__` and `InfiniteWords.__call__` in the sense
 that first the function does:

 {{{
 if datatype is not None:
     #return directly the good word
     if datatype in ['str', 'list', 'char', 'tuple']:
         return etc...
 else:
     #guess the datatype, the length, etc.
 }}}

 if you agree. It makes the code easier to read and be convince anybody
 that it does the minimal and most efficient path in the function.

 Doing what you do in `InfiniteWords.__call__` essentially reverts ticket
 #17021 where that kind of guessing was done first. Note that to avoid
 duplication of code, it is possible that you will have to recreate
 `_word_from_callable` because of that... or maybe not.

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