Opened 4 years ago

Closed 4 years ago

# py3: fixing doctests in elliptic_curves/cm.py

Reported by: Owned by: chapoton major sage-8.6 python3 tscrim, cremona Frédéric Chapoton John Cremona N/A 5403ce7 5403ce7894ea03db25c8fcf23ae156993b54c4cf

### Description

by more sorting of discriminants

### comment:1 Changed 4 years ago by chapoton

• Branch set to u/chapoton/26914
• Status changed from new to needs_review

New commits:

 ​9d5f2f9 `py3: fixes in elliptic_curves/cm.py`

### comment:2 Changed 4 years ago by cremona

All looks fine apart from this:

```-    dlist = sum([v for h, v in iteritems(discriminants_with_bounded_class_number(K.degree(), proof=proof))], [])
+    dlist = sorted(Df for v in discriminants_with_bounded_class_number(K.degree(), proof=proof).values() for Df in v)
```

whose syntax looks suspicious to me.

### comment:3 follow-up: ↓ 4 Changed 4 years ago by chapoton

Hmm. Why suspicious ? The "sorted" is the only real change we are making here. If my understanding of the mathematics involved is ok, this should not be a problem.

Or maybe you are troubled by the double for ? This is a perfectly valid python syntax. We can chain the "for", the second one depending on the argument of the first. Here the effect is to flatten a list of lists.

### comment:4 in reply to: ↑ 3 Changed 4 years ago by cremona

Hmm. Why suspicious ? The "sorted" is the only real change we are making here. If my understanding of the mathematics involved is ok, this should not be a problem.

Or maybe you are troubled by the double for ? This is a perfectly valid python syntax. We can chain the "for", the second one depending on the argument of the first. Here the effect is to flatten a list of lists.

Thanks for the lesson! I had never seen a double for so thought it was a mistake (and did not have time to check).

### comment:5 Changed 4 years ago by git

• Commit changed from 9d5f2f9ad4b311b8775031624c5fc0b54c124bbf to 5403ce7894ea03db25c8fcf23ae156993b54c4cf

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

 ​5403ce7 `trac 26914 fix pyflakes warning`