Opened 2 years ago
Closed 2 years ago
#24126 closed enhancement (fixed)
py3: some more care for keys()[...]
Reported by:  chapoton  Owned by:  

Priority:  major  Milestone:  sage8.1 
Component:  python3  Keywords:  
Cc:  tscrim, jdemeyer, jhpalmieri  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Jeroen Demeyer 
Report Upstream:  N/A  Work issues:  
Branch:  62750bf (Commits)  Commit:  62750bfca20fa155c92687570657bf923eaeb41b 
Dependencies:  Stopgaps: 
Change History (11)
comment:1 Changed 2 years ago by
 Branch set to u/chapoton/24126
 Cc tscrim jdemeyer jhpalmieri added
 Commit set to 6015764ed91081b13c701b825dac755eebee51d8
 Status changed from new to needs_review
comment:2 Changed 2 years ago by
Replace list(d.keys())
by list(d)
for a dict d
.
comment:3 Changed 2 years ago by
And replace list(d.keys())[0]
by next(iter(d))
.
comment:4 Changed 2 years ago by
 Commit changed from 6015764ed91081b13c701b825dac755eebee51d8 to 9e4208d5c42c74a7b69a4f9f0d46042ed0280972
Branch pushed to git repo; I updated commit sha1. New commits:
9e4208d  trac 24126 better like that

comment:5 Changed 2 years ago by
Thanks, done.
comment:6 Changed 2 years ago by
 In
src/sage/numerical/mip.pyx
andsrc/sage/numerical/sdp.pyx
, you can remove theassert
statements.
 In
src/sage/rings/polynomial/multi_polynomial_element.py
, you still havelist(x.dict().keys())[0]
 In
src/sage/rings/polynomial/multi_polynomial_element.py
you can simplifyrange( 0 , max(m[var_idx] for m in monomial_coefficients.keys())+1 )
to
range(max(m[var_idx] for m in monomial_coefficients) + 1)
 In
src/sage/graphs/graph.py
andsrc/sage/graphs/digraph.py
, I would writeif format is None and isinstance(data, dict): if not data: format = 'dict_of_dicts' else: val = next(iter(data.values())) if isinstance(val, list): format = 'dict_of_lists' elif isinstance(val, dict): format = 'dict_of_dicts'
comment:7 Changed 2 years ago by
 Commit changed from 9e4208d5c42c74a7b69a4f9f0d46042ed0280972 to 62750bfca20fa155c92687570657bf923eaeb41b
Branch pushed to git repo; I updated commit sha1. New commits:
62750bf  trac 24126 even better

comment:8 Changed 2 years ago by
Thanks again. Now done.
comment:9 Changed 2 years ago by
and bot is green
comment:10 Changed 2 years ago by
 Reviewers set to Jeroen Demeyer
 Status changed from needs_review to positive_review
comment:11 Changed 2 years ago by
 Branch changed from u/chapoton/24126 to 62750bfca20fa155c92687570657bf923eaeb41b
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
py3: some more care for keys()[...]