Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#24569 closed enhancement (fixed)

py3 : caring for range again

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.2
Component: python3 Keywords:
Cc: jdemeyer, tscrim, fbissey, embray Merged in:
Authors: Frédéric Chapoton Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 31eb6c7 (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description

part of #16081

Change History (8)

comment:1 Changed 5 years ago by chapoton

  • Branch set to u/chapoton/24569
  • Commit set to c5b0e9dba123ad0e02ffccfd902611e7f24f6877
  • Status changed from new to needs_review

New commits:

c5b0e9dpy3 : more care for range

comment:2 Changed 5 years ago by chapoton

green bot

comment:3 Changed 5 years ago by tscrim

The zip should be able to handle this:

  • src/sage/plot/plot.py

    diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
    index 4322987..2928e09 100644
    a b def list_plot_semilogy(data, plotjoined=False, **kwds): 
    32923292
    32933293        ::
    32943294
    3295             sage: xl = [2**k for k in range(12)]; yl = range(len(xl))
     3295            sage: xl = [2**k for k in range(12)]; yl = list(range(len(xl)))
    32963296            sage: list_plot_semilogy(list(zip(xl,yl))) # plot empty due to (1,0)
    32973297            Graphics object consisting of 1 graphics primitive
    32983298

and generates a list of tuples (via list(zip(...))). So I think that change is unnecessary.

comment:4 Changed 5 years ago by git

  • Commit changed from c5b0e9dba123ad0e02ffccfd902611e7f24f6877 to 31eb6c72f542ababb2c42c074bd379ad3ebfaf51

Branch pushed to git repo; I updated commit sha1. New commits:

31eb6c7trac 24569 undo change in plot

comment:5 Changed 5 years ago by chapoton

indeed. Undone

comment:6 Changed 5 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Thanks.

comment:7 Changed 5 years ago by vbraun

  • Branch changed from u/chapoton/24569 to 31eb6c72f542ababb2c42c074bd379ad3ebfaf51
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:8 Changed 5 years ago by chapoton

  • Commit 31eb6c72f542ababb2c42c074bd379ad3ebfaf51 deleted

too late, but still (found by patchbot on #16081)

File "src/sage/plot/plot.py", line 3301, in sage.plot.plot.list_plot_semilogy
Failed example:
    list_plot_semilogy(list(zip(xl[1:],yl[1:])))
Exception raised:
    Traceback (most recent call last):
      File "/home/chapoton/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 533, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/chapoton/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 936, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.plot.list_plot_semilogy[4]>", line 1, in <module>
        list_plot_semilogy(list(zip(xl[Integer(1):],yl[Integer(1):])))
    TypeError: sequence index must be integer, not 'slice'
Note: See TracTickets for help on using tickets.