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

Change gen.python() to return Python objects #21808

Closed
jdemeyer opened this issue Nov 3, 2016 · 49 comments
Closed

Change gen.python() to return Python objects #21808

jdemeyer opened this issue Nov 3, 2016 · 49 comments

Comments

@jdemeyer
Copy link

jdemeyer commented Nov 3, 2016

Currently, gen.python() is the same as gen.sage() which returns Sage objects. There should be a pure Python version, returning Python objects.

We implement the following conversions inside a gen_to_python function

  • t_INT -> int or long
  • t_REAL -> float
  • t_COMPLEX -> complex
  • t_FRAC -> fraction
  • t_INFINITY -> float
  • t_STR -> str
  • t_VEC, t_COL -> list
  • t_MAT -> list of lists

For all other types, the function raises a NotImplementedError.

Depends on #21807

CC: @defeo

Component: interfaces

Keywords: atelierpari2017

Author: Vincent Delecroix

Branch/Commit: ee54f07

Reviewer: Luca De Feo

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

@jdemeyer jdemeyer added this to the sage-7.5 milestone Nov 3, 2016
@jdemeyer
Copy link
Author

jdemeyer commented Nov 4, 2016

Dependencies: #21820

@videlec
Copy link
Contributor

videlec commented Jan 9, 2017

comment:2

I would like to implement a gentopython function from the current gentoobj however very few types would be supported. Unless we allow third party Python modules such as gmpy, mpmath python-flint, etc

I guess the best solution would be to support only t_INT, t_VEC, t_COL, t_VECSMALL and further extend the capabilities once this is moved as a Python module. What do you think?

@jdemeyer
Copy link
Author

jdemeyer commented Jan 9, 2017

comment:3

Why not:

  • t_REAL -> float

  • t_COMPLEX -> complex

  • t_FRAC -> fraction

  • t_STR -> str

  • t_MAT -> list of lists

  • t_INFINITY -> float

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

Changed dependencies from #21820 to #21807

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

Changed keywords from none to atelierpari2017

@videlec

This comment has been minimized.

@videlec videlec modified the milestones: sage-7.5, sage-7.6 Jan 10, 2017
@defeo
Copy link
Member

defeo commented Jan 10, 2017

comment:6

why not t_VEC -> list?

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

comment:7

Replying to @defeo:

why not t_VEC -> list?

Indeed. And t_COL.

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

Commit: 7fbc989

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

Author: Vincent Delecroix

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

Branch: u/vdelecroix/21808

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

New commits:

8b67f8021807: gentoobj -> gentosage
791c1c221807: t_RAT does not exist (documentation issue)
706b3be21807: remove gen_py.py
29f83ed21807: gentosage -> gen_to_sage
a3624b121807: copyright notice
7fbc98921808: gen_to_python

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 7fbc989 to d7ab7f6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

c0ac11b21807: gentosage -> gen_to_sage
d173a7b21807: copyright notice
d7ab7f621808: gen_to_python

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

comment:11

rebased on the correct #21807

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

c0ac79221807: gentoobj -> gentosage
6bd066721808: gen_to_python

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from d7ab7f6 to 6bd0667

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

comment:13

rebased on #21807 and all tests pass in libs/pari, libs/cypari2 and structure/.

@videlec

This comment has been minimized.

@jdemeyer
Copy link
Author

comment:15

(Edit: wrong ticket)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 6bd0667 to 2c83d77

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 2c83d77 to 442299f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

442299f21808: remove the TODO comment

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

dade42d21808: remove the `_eval_` method

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 442299f to dade42d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

5a0311c21808: remove "locals" + documentation

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from dade42d to 5a0311c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 5a0311c to 8fb6000

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8fb600021808: remove "locals" + documentation

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

6ddac6c21808: change .python() -> .sage() in sage/matrix/

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 8fb6000 to 6ddac6c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

01ad2d821808: .python() -> .sage() in sage/modular/
79397fb21808: some more .python() -> .sage() conversions

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 6ddac6c to 79397fb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

Changed commit from 79397fb to 183588e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 10, 2017

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

183588e21808: fix some more .python() .sage()

@videlec

This comment has been minimized.

@videlec
Copy link
Contributor

videlec commented Jan 10, 2017

comment:27

all tests pass on my computer

@defeo
Copy link
Member

defeo commented Jan 11, 2017

Changed branch from u/vdelecroix/21808 to u/defeo/21808

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 11, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8fb600021808: remove "locals" + documentation
6ddac6c21808: change .python() -> .sage() in sage/matrix/
01ad2d821808: .python() -> .sage() in sage/modular/
79397fb21808: some more .python() -> .sage() conversions
183588e21808: fix some more .python() .sage()
87b6ac3Merge branch 't/21807/21807' into HEAD
ee54f07Python 3 compatibility in doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 11, 2017

Changed commit from 183588e to ee54f07

@videlec
Copy link
Contributor

videlec commented Jan 11, 2017

comment:30

And now patchbot is happy ;-)

@defeo
Copy link
Member

defeo commented Jan 12, 2017

comment:31

I'm happy, Patchbot's happy, everyone's happy!

@defeo
Copy link
Member

defeo commented Jan 12, 2017

Reviewer: Luca De Feo

@vbraun
Copy link
Member

vbraun commented Jan 18, 2017

Changed branch from u/defeo/21808 to ee54f07

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

4 participants