#17021: Faster creation of words by the parent
-------------------------+-------------------------------------------------
Reporter: | Owner:
slabbe | Status: needs_work
Type: | Milestone: sage-6.4
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
combinatorics | Work issues:
Keywords: | Commit:
Authors: | 9008b8d2986614ece259a54274ae054ef5fad40d
Sébastien Labbé | Stopgaps:
Report Upstream: N/A |
Branch: |
u/slabbe/17021 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by slabbe):
> 2) Calling directly `.finite_word_tuple()` or `.finite_word_list()` from
the methods in `FiniteWord` is bad. Doing that you impose the return type
to be `FiniteWord_list` or `FiniteWord_tuple` (you might prefer a
`FiniteWord_char` sometimes).
What do you think if we do the following?
{{{
#!diff
@lazy_attribute
def _element_classes(self):
[...]
# test whether or not we can use the class Finiteword_char
if (self.alphabet().cardinality() <= 256 and
all(isinstance(i, (int,Integer)) and 0 <= i < 256 for i in
self.alphabet())):
L = self.alphabet().list()
if (all(L[i] < L[i+1] for i in range(len(L)-1)) and
all(self.cmp_letters(L[i],L[i+1]) == -1 for i in
range(len(L)-1))):
classes['FiniteWord_char'] = word.FiniteWord_char
+ classes['FiniteWord_list'] = word.FiniteWord_char
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17021#comment:7>
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.