Python | sympy.S() method
With the help of sympy.S() method, we can make a single instance of an object by using sympy.S() method, where S denotes to singleton class.
Syntax :
sympy.S()
Return : Return the single instance of an object.
Example #1 :
In this example we can see that by using sympy.S() method, we are able to create a single instance of any object.
# import sympy from sympy import * # Use sympy.S() method gfg = Integer(0) print(gfg == S.Zero) |
chevron_right
filter_none
Output :
True
Example #2 :
# import sympy from sympy import * # Use sympy.S() method gfg = Rational(1, 2) print(gfg == S.Half) |
chevron_right
filter_none
Output :
True
Recommended Posts:
- class method vs static method in Python
- Python | os.dup() method
- Python | set() method
- Python | next() method
- Python | os.closerange() method
- Python | os.times() method
- Python | os.close() method
- Python | os.makedev() method
- Python | os.removedirs() method
- Python | os.sched_get_priority_max() method
- Python | os.getcwdb() method
- Python | os.getgroups() method
- Python | os.dup2() method
- Python | os.sched_rr_get_interval() method
- Python | Tensorflow sin() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



