Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array nodes should have a __repr__ #165

Closed
inducer opened this issue Oct 12, 2021 · 2 comments · Fixed by #185 · May be fixed by #181
Closed

Array nodes should have a __repr__ #165

inducer opened this issue Oct 12, 2021 · 2 comments · Fixed by #185 · May be fixed by #181

Comments

@inducer
Copy link
Owner

inducer commented Oct 12, 2021

(Possibly also a __str__?)

Not having a meaningful print syntax makes debugging code kind of a pain. We'll have to figure out how much of the DAG to actually print. We probably want a StringifyMapper (or some such) that's somewhat customizable, to use as the basis of this functionality.

cc @kaushikcfd

@matthiasdiener
Copy link
Collaborator

As a side note, this package might be interesting to print a dag to the console: https://github.com/sambrightman/asciidag

@kaushikcfd
Copy link
Collaborator

I very much like the approach taken by pymbolic. __repr__ is something that could be be used to put in a REPL to reproduce the expression, but I'm not sure it will be helpful for debugging because the size of the expressions will quickly get out of hand (or even mutliple hands for that matter :p). And __str__ could be something for similar to an array expression, probably could be left unimplemented for non-standard IndexLambdas.

https://github.com/sambrightman/asciidag

Thanks! This is also very convenient to have in certain cases.

This was linked to pull requests Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants