Subset_s _an_element_
Closed this issue · 9 comments
Currently the Subset_s.an_element() method returns a different result from the Subset_s._an_element_() method. The proposed fix is to move the current implementation of an_element to _an_element_ and let the parent framework take care of the rest.
sage: from sage.combinat.subset import Subsets_s
sage: Subsets_s([1,2,3])._an_element_()
{}
sage: Subsets_s([1,2,3]).an_element()
{1, 2}
CC: @tscrim
Component: combinatorics
Keywords: gsoc2022 subsets elements
Author: Trevor K. Karn
Branch/Commit: 922c40a
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/33990
Description changed:
---
+++
@@ -1 +1,9 @@
Currently the `Subset_s.an_element()` method returns a different result from the `Subset_s._an_element_()` method. The proposed fix is to move the current implementation of `an_element` to `_an_element_` and let the parent framework take care of the rest.
+
+```
+sage: from sage.combinat.subset import Subsets_s
+sage: Subsets_s([1,2,3])._an_element_()
+{}
+sage: Subsets_s([1,2,3]).an_element()
+{1, 2}
+```New commits:
922c40a | Change an_element to _an_element_ |
Commit: 922c40a
Branch: u/tkarn/33990-an_element
Reviewer: Travis Scrimshaw
Strictly speaking, this is not a bug: we provide a default implementation of an_element() that caches the result of _an_element_() (which has its own generic implementation). However, we have no requirement that they both need to be implemented non-generically and return the same result. However, I do find that by using the caching mechanism this becomes an improvement. Once the patchbot comes around and is green, then this is a positive review.
It looks like a plugin failed, but I am not sure how to read the message. Do you have any advice?
That one can be ignored.
Changed branch from u/tkarn/33990-an_element to 922c40a