After Python 3.6 dataclasses were introduced.

Usually, the basic objects of symbolic computation (term) is based on 
syntactic equality between the objects, which has isomorphism or 
homomorphism (if there is eager evaluation) from term algebra 
<https://en.wikipedia.org/wiki/Term_algebra>, which dataclass can easily 
implement.

For example, dataclass(frozen=True) can easily give immutable objects, 
built in syntactic equality, and also the substitution operation between 
terms to terms, and also default printing capability, such that it is less 
black boxed version of python object.

It is easy to implement a symbolic computation library with dataclasses, 
without a need to implement everything from scratch, so it can be a 
consideration for future in SymPy library to refactor or if we can 
encourage people to implement new symbolic objects in this paradigm, than 
sticking to the old architecture.

There are alternatives like typing.NamedTuple or typing.TypedDict. And 
there is controversy between which has less overhead. However, I assume 
that they are feasible solution if you need untyped calculus. (There are 
sometimes cases where untyped calculus is more natural model for the 
problem, like if we have to dynamically create huge numbers of classes with 
different names)

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/d9caad27-fb02-434a-b260-5ab80df91f9an%40googlegroups.com.

Reply via email to