Why no list as dict key?

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 20 22:05:12 EDT 2022


On 21/04/22 8:18 am, Avi Gross wrote:
> I am thinking as an example about a program I wrote ages ago that deals with equations in symbolic form and maintains a collection of forms of the equation it is trying to take a derivative or integral of by applying an assortment of typographic rules.

It sounds like you would be better off making all your equation data
structures immutable. Instead of mutating the equation when making
a transformation, return a new equation. Then you can use sets and
dicts to cache them etc. without any problems.

-- 
Greg



More information about the Python-list mailing list