#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:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/19619 | 449488686e52fb15a2a333073eed39403803347f
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Replying to [comment:21 slabbe]:
> Should a parent return an element for which he is the parent?
There are other parents doing the same
{{{
sage: NN.an_element().parent() == NN
False
sage: Primes().an_element().parent() == NN
False
}}}
And this is the concept of facade (in the Sage category sense).
With my branch you always have:
- finte words have a parent `FiniteWords`
- infinite words have a parent `InfiniteWords`
- words with indefinite status have a parent `FiniteOrInfiniteWords`
In particular
{{{
sage: W = Words('ab')
sage: W('ab').parent() is W.finite_words()
True
sage: W(lambda n: 'a', length='infinite').parent() is W.infinite_words()
True
sage: W(iter("ab"*100)).parent() is W
True
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/19619#comment:23>
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.