Code Monkey home page Code Monkey logo

Comments (4)

kaushikcfd avatar kaushikcfd commented on May 25, 2024

Hello @redrossa.
Could you please attach a minimal failing script that would make this behavior clearer, because at least for primitve expression nodes provided by pymbolic equality comparison doesn't go through a Mapper.

from pymbolic.

redrossa avatar redrossa commented on May 25, 2024

Hello @kaushikcfd

My main issue is that I'm trying to compare a pymbolic expression tree to another. However the following example snippet will fail:

Sum(([1,2], [1,2])) == Sum(([1,2], [1,2]))

I'm not sure if this was intentional to force users to create an expression wrapper for foreign, non-primitive and especially unhashable types, like lists, but if it was, it seems quite inconsistent with the design of the Mapper class where it can directly visit expressions whose nodes are lists or even numpy arrays since it provides signatures for map_list or even map_numpy_array unimplemented methods.

from pymbolic.

inducer avatar inducer commented on May 25, 2024

It might be worth it to change __eq__ to also use the mapper infrastructure. The second argument could be used for the traversal of the second argument. This would give us a bit more dispatch flexibility. I'd be happy to consider a PR.

from pymbolic.

redrossa avatar redrossa commented on May 25, 2024

@inducer Are you talking about changing __eq__ to an implementation similar to __str__ using a mapper? I think that would definitely allow users to customize how foreign object nodes would equalize against another.

from pymbolic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.