Skip to content

Commit deeb6a9

Browse files
committed
Address reviewer comments
1 parent 9412c4c commit deeb6a9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

symengine/lib/symengine_wrapper.pyx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import itertools
1212
from operator import mul
1313
from functools import reduce
1414
import collections
15-
15+
import warnings
1616

1717
include "config.pxi"
1818

@@ -366,6 +366,12 @@ class DictBasic(_DictBasic, collections.MutableMapping):
366366
return self.__str__()
367367

368368
def get_dict(*args):
369+
"""
370+
Returns a DictBasic instance from args. Inputs can be,
371+
1. a DictBasic
372+
2. a Python dictionary
373+
3. two args old, new
374+
"""
369375
if len(args) == 2:
370376
arg = {args[0]: args[1]}
371377
elif len(args) == 1:
@@ -482,18 +488,17 @@ cdef class Basic(object):
482488
cdef Basic s = sympify(x)
483489
return c2py(symengine.diff(self.thisptr, s.thisptr))
484490

485-
#TODO: deprecate this
486491
def subs_dict(Basic self not None, *args):
487-
cdef _DictBasic D = get_dict(*args)
488-
return c2py(symengine.msubs(self.thisptr, D.c))
492+
warnings.warn("subs_dict() is deprecated. Use subs() instead", DeprecationWarning)
493+
return self.subs(*args)
489494

490-
#TODO: deprecate this
491495
def subs_oldnew(Basic self not None, old, new):
492-
return self.subs_dict({old: new})
496+
warnings.warn("subs_oldnew() is deprecated. Use subs() instead", DeprecationWarning)
497+
return self.subs({old: new})
493498

494499
def subs(Basic self not None, *args):
495500
cdef _DictBasic D = get_dict(*args)
496-
return c2py(symengine.msubs(self.thisptr, D.c))
501+
return c2py(symengine.ssubs(self.thisptr, D.c))
497502

498503
xreplace = subs
499504

0 commit comments

Comments
 (0)