@@ -12,7 +12,7 @@ import itertools
12
12
from operator import mul
13
13
from functools import reduce
14
14
import collections
15
-
15
+ import warnings
16
16
17
17
include " config.pxi"
18
18
@@ -366,6 +366,12 @@ class DictBasic(_DictBasic, collections.MutableMapping):
366
366
return self .__str__ ()
367
367
368
368
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
+ """
369
375
if len (args) == 2 :
370
376
arg = {args[0 ]: args[1 ]}
371
377
elif len (args) == 1 :
@@ -482,18 +488,17 @@ cdef class Basic(object):
482
488
cdef Basic s = sympify(x)
483
489
return c2py(symengine.diff(self .thisptr, s.thisptr))
484
490
485
- # TODO: deprecate this
486
491
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 )
489
494
490
- # TODO: deprecate this
491
495
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})
493
498
494
499
def subs (Basic self not None , *args ):
495
500
cdef _DictBasic D = get_dict(* args)
496
- return c2py(symengine.msubs (self .thisptr, D.c))
501
+ return c2py(symengine.ssubs (self .thisptr, D.c))
497
502
498
503
xreplace = subs
499
504
0 commit comments