Skip to content

py3: Adapt Sage's range-like functions #30121

@slel

Description

@slel

Python 2 had range (returning lists) and xrange (returning iterators).

Python 3 only has range which behaves like the old xrange.

This ticket is to rename or change our range-like functions accordingly.

To go further we could make sure they all follow similar semantics, i.e.:

  • f(a) for the range from 0 included to a excluded
  • f(a, b) for the range from a included to b excluded
  • f(a, b, c) for the range from a included to b excluded, by steps of c

Functions in the global name space:

  • ellipsis_range
  • fibonacci_xrange
  • mrange
  • mrange_iter
  • prime_range
  • randrange
  • range
  • srange
  • sxrange
  • xmrange
  • xmrange_iter
  • xsrange

See also:

CC: @slel @tscrim @fchapoton

Component: python3

Keywords: range

Branch/Commit: public/srange_as_iterator @ 3cee22e

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

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