sympify: add support for objects that implement __int__ (#722)
commit0e417b93694fb395f7b847b674378212ab73fc5e
authorKirill Smelkov <kirr@landau.phys.spbu.ru>
Fri, 29 Feb 2008 22:31:15 +0000 (1 01:31 +0300)
committerKirill Smelkov <kirr@landau.phys.spbu.ru>
Fri, 29 Feb 2008 22:31:15 +0000 (1 01:31 +0300)
tree18a8dbb7c81fabf7968bc58bca73aa62411679df
parent7a246ac2378ee35cff0087ecdd2a2a58ac4ea305
sympify: add support for objects that implement __int__  (#722)

Also we need to be careful not to call __int__ or _sympy_ on classes, e.g.

class C:

    def _sympy_(self):
        return <smth>

Previously sympify(C) would try to call C._int_() which is not what we want.

based on patch by Ondrej Certik
sympy/core/sympify.py
sympy/core/tests/test_basic.py