Skip to content

Commit f952462

Browse files
committed
remove (again) sympy_dummy attribute from symbols
1 parent a58b6ca commit f952462

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

mathics/core/symbols.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ class Symbol(Atom, NumericOperators, EvalMixin):
342342

343343
name: str
344344
hash: int
345-
sympy_dummy: Any
346345
_short_name: str
347346

348347
# Dictionary of Symbols defined so far.
@@ -355,7 +354,7 @@ class Symbol(Atom, NumericOperators, EvalMixin):
355354

356355
# __new__ instead of __init__ is used here because we want
357356
# to return the same object for a given "name" value.
358-
def __new__(cls, name: str, sympy_dummy=None):
357+
def __new__(cls, name: str):
359358
"""
360359
Allocate an object ensuring that for a given ``name`` and ``cls`` we get back the same object,
361360
id(object) is the same and its object.__hash__() is the same.
@@ -383,20 +382,7 @@ def __new__(cls, name: str, sympy_dummy=None):
383382
# Python objects, so we include the class in the
384383
# event that different objects have the same Python value.
385384
# For example, this can happen with String constants.
386-
387385
self.hash = hash((cls, name))
388-
389-
# TODO: revise how we convert sympy.Dummy
390-
# symbols.
391-
#
392-
# In some cases, SymPy returns a sympy.Dummy
393-
# object. It is converted to Mathics as a
394-
# Symbol. However, we probably should have
395-
# a different class for this kind of symbols.
396-
# Also, sympy_dummy should be stored as the
397-
# value attribute.
398-
self.sympy_dummy = sympy_dummy
399-
400386
self._short_name = strip_context(name)
401387

402388
return self
@@ -405,7 +391,7 @@ def __eq__(self, other) -> bool:
405391
return self is other
406392

407393
def __getnewargs__(self):
408-
return (self.name, self.sympy_dummy)
394+
return (self.name,)
409395

410396
def __hash__(self) -> int:
411397
"""
@@ -703,6 +689,9 @@ def __new__(cls, name, value):
703689
self.hash = hash((cls, name))
704690
return self
705691

692+
def __getnewargs__(self):
693+
return (self.name, self._value)
694+
706695
@property
707696
def is_literal(self) -> bool:
708697
"""

0 commit comments

Comments
 (0)