Skip to content

Conversation

@alexmojaki
Copy link

With these changes, p will show the source code of expressions being printed and g can transport variables without specifying the name, e.g. g / y instead of g.y / y. Here's an example script:

from boxx import p, g, gg

x = [i * 2 for i in range(5)]
p / [p / x[0], p ** x[1], p - x[2], p << x[3], p >> x[4]]


def foo():
    y = 4
    z = 5
    gg / y
    g / z


foo()
print(y, z)

Output:

x[0] = 0
x[1] = 2
x[2] = 4
x[3] = 6
x[4] = 8
[p / x[0], p ** x[1], p - x[2], p << x[3], p >> x[4]] = [0, 2, 4, 6, 8]
gg.y:"4"
4 5

This is thanks to my library executing.

I would appreciate it if you could add some links to some of my other debugging libraries which I think your users would be interested in:

  • snoop: a better version of PySnooper. It includes a function pp.deep which is similar to logc but shows all sub-expressions, not just variables.
  • heartrate: a real time visualisation of a program similar to pyheat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant