#12867: random_element for Words is broken
-------------------------+-------------------------------------------------
Reporter: | Owner: sage-combinat
AlexGhitza | Status: needs_work
Type: | Milestone: sage-6.2
defect | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
combinatorics | Work issues:
Keywords: | Commit:
Authors: | 035603dd0c523ff054ffdc2d993b1898d827cf3a
Report Upstream: N/A | Stopgaps:
Branch: |
u/ncohen/12867 |
Dependencies: |
-------------------------+-------------------------------------------------
Changes (by vdelecroix):
* status: needs_review => needs_work
Comment:
Hi there,
Suggestions, tasks and questions:
0) Might be rebased for 6.2.rc0
1) Add doctest for your errors
2) The following code
{{{
self((self.alphabet()[randint(0,n-1)] for x in range(self._length)))
}}}
does not handle all cases. For example
{{{
sage: W = Words(GF(5), length=4)
sage: W.random_element()
KABOOM
}}}
The problem is that you really do not know what is the `__getitem__`
there. A possibility is
{{{
self((self.alphabet().random_element() for _ in range(self._length)))
}}}
3) What is the purpose of the commit
241a151def174f9cfa93340fd3dd2a9be1d4aa81 that modifies stuff in
shuffle_algebra.py, algebras_with_basis.py, lyndon_word.py, etc?
Vincent
--
Ticket URL: <http://trac.sagemath.org/ticket/12867#comment:16>
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.