Opened 3 years ago

Closed 3 years ago

#25845 closed enhancement (fixed)

Move Set_PythonType to a separate file

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-8.4
Component: coercion Keywords:
Cc: tscrim Merged in:
Authors: Jeroen Demeyer Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 8005a7b (Commits, GitHub, GitLab) Commit: 8005a7b4e905f7924af8fbaf250d6c3bfe38dc18
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

This is done mainly to avoid cyclic imports when enabling binding=True (#22747).

I'm also removing this pointless implementation of cardinality():

    def cardinality(self):
        from sage.rings.integer import Integer
        two = Integer(2)
        if self._type is bool:
            return two
        elif self._type is int:
            import sys
            return two * sys.maxsize + 2
        elif self._type is float:
            return 2 * two**52 * (two**11 - 1) + 3 # all NaN's are the same from Python's point of view
        else:
            # probably
            import sage.rings.infinity
            return sage.rings.infinity.infinity

Somebody probably found this clever, but it's just silly... who cares how many different int instances there exist? Besides, it's wrong in Python 3.

Change History (6)

comment:1 Changed 3 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 3 years ago by jdemeyer

  • Branch set to u/jdemeyer/ticket/25845

comment:3 Changed 3 years ago by jdemeyer

  • Commit set to 8005a7b4e905f7924af8fbaf250d6c3bfe38dc18
  • Status changed from new to needs_review

New commits:

8005a7bMove Set_PythonType to a new file

comment:4 Changed 3 years ago by tscrim

  • Reviewers set to Travis Scrimshaw

Green bot => positive review.

comment:5 Changed 3 years ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:6 Changed 3 years ago by vbraun

  • Branch changed from u/jdemeyer/ticket/25845 to 8005a7b4e905f7924af8fbaf250d6c3bfe38dc18
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.