Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
adding _an_element_ method for Words
Browse files Browse the repository at this point in the history
  • Loading branch information
avirmaux committed Apr 10, 2014
1 parent 37c8a8c commit b9d0ac1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/sage/combinat/words/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,27 @@ def _element_classes(self):
'Word_iter': word.Word_iter
}

def _an_element_(self):
r"""
Return an element of self.
EXAMPLES::
sage: W = Words(4)
sage: W.an_element()
word:
TESTS:
Check that :trac:`16125` is fixed::
sage: W = Words(4)
sage: w = W([3,1,2,1])
sage: w in ZZ
False
"""
return self([])

def __call__(self, data=None, length=None, datatype=None, caching=True, **kwds):
r"""
Construct a new word object with parent self.
Expand Down

0 comments on commit b9d0ac1

Please sign in to comment.