Skip to content

Register FreeModuleElement to the Sequence ABC #24815

@embray

Description

@embray

For most intents and purposes instances of FreeModuleElement can be used equivalently to list or tuple, in that they all meet the requirements of the Sequence protocol (which on Python 3 also includes range).

This simplifies some code that treats Vector distinctly from list and tuple. To be clear, in this case we are explicitly treating the FreeModuleElement type, and not the abstract Vector type which does not meet these requirements, but that's okay since FreeModuleElement implements any concrete vector space elements.

By convention, this always imports collections.Sequence as SequenceABC so as to not confuse it with Sage's Sequence class.

See also: #26769 Add an issequence utility to check for list, tuple, and other compatible objects

Component: refactoring

Author: Erik Bray

Branch/Commit: u/embray/refactoring/free-module-sequence @ 9660547

Issue created by migration from https://trac.sagemath.org/ticket/24815

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions