Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py3 care for range again #22779

Closed
fchapoton opened this issue Apr 7, 2017 · 12 comments
Closed

py3 care for range again #22779

fchapoton opened this issue Apr 7, 2017 · 12 comments

Comments

@fchapoton
Copy link
Contributor

another step in taking care of range, towards python3

part of #16081

CC: @tscrim @jm58660 @jdemeyer

Component: python3

Author: Frédéric Chapoton

Branch/Commit: 0d3b15a

Reviewer: Travis Scrimshaw

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

@fchapoton fchapoton added this to the sage-8.0 milestone Apr 7, 2017
@fchapoton
Copy link
Contributor Author

Branch: u/chapoton/22779

@fchapoton
Copy link
Contributor Author

New commits:

2d622e9trac 22779 py3 range in various files

@fchapoton
Copy link
Contributor Author

Commit: 2d622e9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 7, 2017

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

bd4921etrac 22779 one more fix for range

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 7, 2017

Changed commit from 2d622e9 to bd4921e

@tscrim
Copy link
Collaborator

tscrim commented Apr 7, 2017

comment:4

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)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 7, 2017

Changed commit from bd4921e to 0d3b15a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 7, 2017

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

0d3b15atrac 22779 undo change in simplicial set morphism

@fchapoton
Copy link
Contributor Author

comment:6

thanks, undone

@tscrim
Copy link
Collaborator

tscrim commented Apr 8, 2017

comment:7

Thanks. LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Apr 8, 2017

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Apr 10, 2017

Changed branch from u/chapoton/22779 to 0d3b15a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants