Opened 11 years ago

Closed 7 years ago

#6132 closed defect (duplicate)

[with patch, needs work] cmp for number field elements

Reported by: robertwb Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

See discussion at http://groups.google.com/group/sage-nt/browse_thread/thread/422606e40805d5d0?hl=en

Note that cmp(list(a), list(b)) can be slow...

Attachments (1)

6132-nf-elt-cmp.patch (3.7 KB) - added by robertwb 11 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 11 years ago by rlm

Minor, but I just fixed two of these elsewhere: it's spelled "consistent"

Changed 11 years ago by robertwb

comment:2 Changed 11 years ago by robertwb

  • Summary changed from cmp for number field elements to [with patch, needs review] cmp for number field elements

comment:3 Changed 11 years ago by AlexGhitza

  • Summary changed from [with patch, needs review] cmp for number field elements to [with patch, needs work] cmp for number field elements

The patch applies with some fuzz to 4.0.rc2, but I'm seeing a bunch of doctest failures in sage/rings:

The following tests failed:


	sage -t  "devel/sage-main/sage/rings/number_field/number_field.py"
	sage -t  "devel/sage-main/sage/rings/number_field/number_field_rel.py"
	sage -t  "devel/sage-main/sage/rings/number_field/order.py"
	sage -t  "devel/sage-main/sage/rings/number_field/galois_group.py"
	sage -t  "devel/sage-main/sage/rings/number_field/number_field_element.pyx"
	sage -t  "devel/sage-main/sage/rings/number_field/number_field_ideal.py"
	sage -t  "devel/sage-main/sage/rings/number_field/number_field_ideal_rel.py"
	sage -t  "devel/sage-main/sage/rings/number_field/unit_group.py"
	sage -t  "devel/sage-main/sage/rings/polynomial/complex_roots.py"
	sage -t  "devel/sage-main/sage/rings/polynomial/polynomial_element.pyx"

comment:4 Changed 10 years ago by nbruin

  • Owner changed from somebody to nbruin
  • Report Upstream set to N/A

In Python 3, "greater than" etc. comparisons between objects where no natural ordering exist are supposed to raise a "TypeError?"

Already, comparing complex numbers in Python 2.6.2 raises TypeError: no ordering relation is defined for complex numbers

Changing this will probably lead to even more doctest failures, but brings us closer to Python's way of doing things and to mathematical sanity.

comment:5 Changed 10 years ago by nbruin

  • Owner changed from nbruin to (none)

comment:6 Changed 10 years ago by robertwb

Note that to follow this convention, we have to use richcmp as == and != should still work for unordered elements.

comment:7 Changed 9 years ago by kcrisman

Apparently related to #7160 and #10064, see this sage-devel discussion.

comment:8 follow-up: Changed 9 years ago by was

See also #9572.

comment:9 in reply to: ↑ 8 Changed 9 years ago by kcrisman

Replying to was:

See also #9572.

That is a SageNB release ticket. ?

comment:10 Changed 8 years ago by was

See #7160 for a related ticket/discussion.

comment:11 Changed 7 years ago by mhansen

  • Milestone changed from sage-5.11 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from needs_work to closed

I think we can close this as a duplicate of those other tickets now that they are merged.

Note: See TracTickets for help on using tickets.