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
Sets printing issues #10672
Comments
I would like to work on this. |
@asmeurer Regarding the issue 1 . I find it outputs something else on the sympy live shell . Kindly have a look .
Also,
|
The output is the same on sympy live |
@AnishShah but here have a look at this screenshot of what i tried on sympy live. If I am going wrong somewhere then kindly guide. |
I'm sorry if I'm missing something, but the output in your screenshot is same as the output mentioned by @asmeurer. I don't see any difference. |
'[0, 1]' and [0, 1] . I think it is already a string after getting evaluated by str. |
@SalilVishnuKapur that's because the SymPy Live shell renders the output as LaTeX. You should work locally against the git master. SymPy Live has some differences against the normal SymPy which might confuse, but more importantly, it runs SymPy 0.7.6, whereas you want to work against the git master. |
I would like to take this up. :) |
I also want to work on this but i am new here so how should start? |
It looks like this has already been started at #10708, so you should at least wait until that is merged and see if anything is left to do then. |
Also see https://github.com/sympy/sympy/wiki/Development-workflow for general instructions on how to contribute. |
Ohkk thanks Aaron Meurer!!! I will wait for that or I will work on other Issue. Thanks for suggestion. |
Related #10035 |
@Upabjojr wrong number? I don't see how that's related. |
Sorry, I wanted to link the issue of the |
Please review #12112 |
@SagarB-97 github apparently closed the issue automatically, I didn't actually notice that. |
Fixing sympy#10672, fixes printing of S.Integers, S.Reals, S.Naturals and S.Naturals0 in both str() and srepr().
Is this the expected behaviour of >>> from sympy import S
>>> from sympy import srepr
>>> print(S.Integers)
S.Integers
>>> S.Naturals0
S.Naturals0
>>> srepr(S.Naturals)
'S.Naturals'
>>> str(S.Reals)
'S.Reals' I implemented this but then did not pass the tests as the examples and tests are written for the previous output. Please tell me if this is what was desired so I can fix the tests and examples for the new output. |
It looks like points 1 and 3 are now fixed. It is no longer necessary to print the fancy sets with However, this is still wrong: >>> srepr(Integers)
Integers() because |
Thanks, will fix |
Some issues with str and srepr printing in sets.
Some notes:
str
printer should always generate valid Python, which recreates the expression (but may require some variables to be defined).srepr
printer should generate an expression that recreates the expression exactly, using only the names fromfrom sympy import *
(or other relevant imports for other submodules, but that isn't relevant for the sets).pprint
andlatex
).Here are the issues I found:
str(Interval)
The former creates a list, not an interval. The latter isn't even valid Python.
srepr(S.Integers)
(and probably others)Integers
isn't a name that is imported fromsympy
. It should print asS.Integers
. Thestr
printers should probably do the same.str(Union)
It's not valid Python. It should print as
Union(S.Integers, FiniteSet(pi))
. Printing asUnion(S.Integers, {pi})
is fine when sympify(set) should give FiniteSet #10654 gets merged.There are likely others. I didn't check too much. An audit of the printing in the sets module would be worthwhile.
The text was updated successfully, but these errors were encountered: