-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
get rid of six.iterkeys #29077
Comments
New commits:
|
Commit: |
Branch: u/chapoton/29077 |
comment:2
green bot, please review |
comment:4
This is kind of a while-we-are-at-it thing, but I think we can avoid the double call to if not coeff:
coeff = self.base_ring().one()
else:
- coeff = self.base_ring()(next(itervalues(f.dict())) / next(itervalues(g.dict())))
+ nf = next(iter(f.dict().values()))
+ ng = next(iter(g.dict().values())) # (trailing whitespace too)
+ coeff = self.base_ring()(nf / ng)
- f = next(iterkeys(f.dict()))
- g = next(iterkeys(g.dict()))
+ f = next(iter(f.dict()))
+ g = next(iter(g.dict())) by instead doing fd = f.dict()
gd = g.dict()
fk = next(iter(fd))
gk = next(iter(gd))
if not coeff:
coeff = self.base_ring().one()
else:
coeff = self.base_ring()(fd[fk] / gd[gk])
f = fk
g = gk |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
Thanks for the review. Here is a proposal, more or less what you suggested. |
Reviewer: Travis Scrimshaw |
comment:7
That is probably a better idea. Thanks. |
Changed branch from u/chapoton/29077 to |
only 3 files are touched
CC: @tscrim @jm58660
Component: python3
Author: Frédéric Chapoton
Branch/Commit:
8d9ecb1
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/29077
The text was updated successfully, but these errors were encountered: