Opened 7 months ago

Closed 6 months ago

Last modified 3 months ago

#33726 closed enhancement (fixed)

get rid of some iteritems

Reported by: Frédéric Chapoton Owned by:
Priority: minor Milestone: sage-9.7
Component: refactoring Keywords:
Cc: Travis Scrimshaw Merged in:
Authors: Frédéric Chapoton Reviewers: Kwankyu Lee
Report Upstream: N/A Work issues:
Branch: 0d580e5 (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Kwankyu Lee)

Change iteritems to items in two py files where iteritems makes no sense with python3.

Also in one pyx file. Note that in pyx files, with python3, items is the same as iteritems.

Change History (9)

comment:1 Changed 7 months ago by Frédéric Chapoton

Branch: u/chapoton/33726
Commit: aa5108410f38f3dd9c6556346a5bbf8e468cb736
Milestone: sage-9.6sage-9.7
Status: newneeds_review

New commits:

aa51084get rid of some iteritems

comment:2 Changed 7 months ago by Kwankyu Lee

in two py files where this makes no sense

What do you mean? You only replaced iteritems with items (of python3).

comment:3 Changed 7 months ago by Kwankyu Lee

While we are at it, why not change for t,g in ... to for t, g in ...?

comment:4 Changed 7 months ago by git

Commit: aa5108410f38f3dd9c6556346a5bbf8e468cb7360d580e574300e7ee44eb22c4856a51e97c413cad

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

0d580e5more spaces after comma

comment:5 in reply to:  2 ; Changed 7 months ago by Frédéric Chapoton

Cc: Travis Scrimshaw added

Replying to klee:

in two py files where this makes no sense

What do you mean? You only replaced iteritems with items (of python3).

Well, I suspect that this part of the code is never doctested. In python3, dictionaries no longer have an iteritems method.

The only thing that still have an iteritems method are sage own's weak dictionaries. We should switch this method's name to items, but not in this ticket.

comment:6 in reply to:  5 Changed 7 months ago by Kwankyu Lee

Description: modified (diff)
Priority: majorminor
Reviewers: Kwankyu Lee
Status: needs_reviewpositive_review

Replying to chapoton:

Replying to klee:

in two py files where this makes no sense

What do you mean? You only replaced iteritems with items (of python3).

Well, I suspect that this part of the code is never doctested. In python3, dictionaries no longer have an iteritems method.

Right.

The only thing that still have an iteritems method are sage own's weak dictionaries. We should switch this method's name to items, but not in this ticket.

Okay.

comment:7 Changed 6 months ago by Volker Braun

Branch: u/chapoton/337260d580e574300e7ee44eb22c4856a51e97c413cad
Resolution: fixed
Status: positive_reviewclosed

comment:8 Changed 6 months ago by Samuel Lelièvre

Commit: 0d580e574300e7ee44eb22c4856a51e97c413cad

This change missed one of the iteritems:

-        for t,g in self._t_dict.iteritems():
-            for k,c in g.monomial_coefficients(copy=False).iteritems():
+        for t, g in self._t_dict.items():
+            for k, c in g.monomial_coefficients(copy=False).iteritems():

comment:9 in reply to:  5 Changed 3 months ago by Matthias Köppe

Replying to Frédéric Chapoton:

The only thing that still have an iteritems method are sage own's weak dictionaries. We should switch this method's name to items, but not in this ticket.

I've opened #34488 for this

Note: See TracTickets for help on using tickets.