details:   http://hg.sympy.org/sympy/rev/1b3bc62700cf
changeset: 1784:1b3bc62700cf
user:      Ondrej Certik <[EMAIL PROTECTED]>
date:      Wed Oct 08 23:59:02 2008 +0200
description:
S(1)/2 implemented.

This was achieved by hooking sympify into S.__call__, because we use S for
singletons already.

Maybe we could use a different name for singletons.

diffs (31 lines):

diff -r 178905a9dc6f -r 1b3bc62700cf sympy/core/basic.py
--- a/sympy/core/basic.py       Tue Oct 07 16:41:55 2008 +0200
+++ b/sympy/core/basic.py       Wed Oct 08 23:59:02 2008 +0200
@@ -2227,6 +2227,9 @@
 
 S = SingletonFactory()
 
+# S(...) = sympify(...)
+S.__call__ = sympify
+
 class ClassesRegistry:
     """Namespace for SymPy classes
 
diff -r 178905a9dc6f -r 1b3bc62700cf sympy/core/tests/test_sympify.py
--- a/sympy/core/tests/test_sympify.py  Tue Oct 07 16:41:55 2008 +0200
+++ b/sympy/core/tests/test_sympify.py  Wed Oct 08 23:59:02 2008 +0200
@@ -1,5 +1,5 @@
 from sympy import Symbol, exp, Integer, Real, sin, cos, log, Poly, Lambda, \
-        Function, I, raises
+        Function, I, S, sqrt,  raises
 from sympy.abc import x, y
 from sympy.core.sympify import sympify, _sympify, _sympifyit, SympifyError
 
@@ -233,3 +233,7 @@
 
     assert a == Integer(4)
     assert a.is_Integer
+
+def test_S_sympify():
+    assert S(1)/2 == sympify(1)/2
+    assert (-2)**(S(1)/2) == sqrt(2)*I

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-commits" group.
To post to this group, send email to sympy-commits@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to