-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #34509: Make IndexedFreeModuleElement compatible with collection…
…s.abc, change method support to return a SupportView This is the element class of a `CombinatorialFreeModule`. Its implementation of `__iter__`, `__contains__`, `__len__` are not compatible with anything in the [[https://docs.python.org/3/library/coll ections.abc.html|collections.abc]] protocols. Specifically, {{{ sage: F = CombinatorialFreeModule(QQ, ['a','b','c']) sage: B = F.basis() sage: f = B['a'] + 3*B['c']; f sage: import collections.abc sage: isinstance(f, collections.abc.Collection) True }}} but `__iter__`ating over this collection gives objects that are not `__contain__`ed in it. To improve interoperability, we propose to make the following changes: - Deprecate the `__contains__` method (currently testing whether a given index is in the support). After its removal, the class would no longer be considered by Python to be a subclass of `collections.abc.Collection`, but merely a `Sized` `Iterable`. - As a replacement for this functionality, revise the method `support` to return an instance of a new class `SupportView`, which provides a fast `__contains__` method, instead of a list. (Similarly, in #24815, it was proposed to make the elements of free modules from `sage.modules` a [[https://docs.python.org/3/library/collec tions.abc.html#collections.abc.Sequence|collections.abc.Sequence]].) Part of Meta-ticket #30309: Unify free module elements API: methods dict, monomial_coefficients, etc. URL: https://trac.sagemath.org/34509 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Travis Scrimshaw
- Loading branch information
Showing
16 changed files
with
246 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tarball=configure-VERSION.tar.gz | ||
sha1=6f8c2081de6c724babc10f767d2090e873fc5c8a | ||
md5=8e938868a2d0af606afacc8aa3b4de59 | ||
cksum=3217316133 | ||
sha1=2b72df4c224b120993d18936397bcd73c04c5b6d | ||
md5=0ea8af9d5139c7d024a0d3153436474c | ||
cksum=1903922458 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
60e5acf5109db9dc40877bd62fad4556b85b8c1d | ||
9d8ff5ded968b56356f5029460efbbd83c56cdf3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.