Opened 5 years ago

Closed 5 years ago

#22779 closed enhancement (fixed)

py3 care for range again

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

Status badges

Description

another step in taking care of range, towards python3

part of #16081

Change History (8)

comment:1 Changed 5 years ago by chapoton

  • Branch set to u/chapoton/22779
  • Cc tscrim jmantysalo jdemeyer added
  • Commit set to 2d622e9cf503120bf661d923c5ecb32701ca4228
  • Status changed from new to needs_review

New commits:

2d622e9trac 22779 py3 range in various files

comment:2 Changed 5 years ago by chapoton

  • Component changed from PLEASE CHANGE to python3

comment:3 Changed 5 years ago by git

  • Commit changed from 2d622e9cf503120bf661d923c5ecb32701ca4228 to bd4921e727caa38d36eefe78c106161e9c616d1d

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

bd4921etrac 22779 one more fix for range

comment:4 Changed 5 years ago by tscrim

These changes seem to be unnecessary in both Python 2 and 3:

@@ -483,7 +484,7 @@ class SimplicialSetMorphism(Morphism):
             if constant is not None:
                 self._constant = constant
                 check = False
-                data = {sigma: constant.apply_degeneracies(*range(sigma.dimension()-1,-1,-1))
+                data = {sigma: constant.apply_degeneracies(*list(range(sigma.dimension()-1,-1,-1)))
                         for sigma in domain.nondegenerate_simplices()}
 
         if (not isinstance(domain, SimplicialSet_arbitrary)
@@ -634,7 +635,7 @@ class SimplicialSetMorphism(Morphism):
             raise ValueError('element is not a simplex in the domain')
         if self.is_constant():
             target = self._constant
-            return target.apply_degeneracies(*range(x.dimension()-1,-1,-1))
+            return target.apply_degeneracies(*list(range(x.dimension()-1,-1,-1)))
         if self._is_identity:
             return x
         return self._dictionary[x.nondegenerate()].apply_degeneracies(*x.degeneracies())

In both Python 2 and 3:

>>> from six.moves import range  # in python 2
>>> it = range(5)
>>> def foo(*args):
...     print(args)
... 
>>> foo(*it)
(0, 1, 2, 3, 4)
>>> it = iter([1,2,3])
>>> foo(*it)
(1, 2, 3)

comment:5 Changed 5 years ago by git

  • Commit changed from bd4921e727caa38d36eefe78c106161e9c616d1d to 0d3b15a4555d5dbe152f2e46e8cd36fc5c048582

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

0d3b15atrac 22779 undo change in simplicial set morphism

comment:6 Changed 5 years ago by chapoton

thanks, undone

comment:7 Changed 5 years ago by tscrim

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

Thanks. LGTM.

comment:8 Changed 5 years ago by vbraun

  • Branch changed from u/chapoton/22779 to 0d3b15a4555d5dbe152f2e46e8cd36fc5c048582
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.