boxx
boxx copied to clipboard
Extra magic for p, g, and gg using executing
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: