Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Set_PythonType to a separate file #25845

Closed
jdemeyer opened this issue Jul 12, 2018 · 7 comments
Closed

Move Set_PythonType to a separate file #25845

jdemeyer opened this issue Jul 12, 2018 · 7 comments

Comments

@jdemeyer
Copy link

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.

CC: @tscrim

Component: coercion

Author: Jeroen Demeyer

Branch/Commit: 8005a7b

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/25845

@jdemeyer jdemeyer added this to the sage-8.4 milestone Jul 12, 2018
@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Author

Branch: u/jdemeyer/ticket/25845

@jdemeyer
Copy link
Author

Commit: 8005a7b

@jdemeyer
Copy link
Author

New commits:

8005a7bMove Set_PythonType to a new file

@tscrim
Copy link
Collaborator

tscrim commented Jul 12, 2018

comment:4

Green bot => positive review.

@tscrim
Copy link
Collaborator

tscrim commented Jul 12, 2018

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Aug 5, 2018

Changed branch from u/jdemeyer/ticket/25845 to 8005a7b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants