Re:What Makes Code Hard to Read: Visual Patterns of Complexi...
by nomel on Tuesday March 11, 2025 @08:51PM
(#43338834)
> Build up and debug the chain as you work in an environment like Jupyter.
> Just run the code and verify that the current step works. Then, proceed to the next.
Yes, it's not debuggable/"viewable" without cut/paste/commenting out lines, once it's constructed.
Re:What Makes Code Hard to Read: Visual Patterns of Complexi...
by __mharrison__ on Wednesday March 12, 2025 @12:13AM
(#43339894)
If it is breakpoints you are concerned about, you can set a breakpoint on a method in the chain and inspect `self`.
Re:What Makes Code Hard to Read: Visual Patterns of Complexi...
by nomel on Wednesday March 12, 2025 @02:19PM
(#43346151)
Most languages don't expose the internal of map to set a breakpoint, so you're left with individual entities. But yes, there are tricks you can use to make it work, although most require more complex conditional/sequential breakpoints. In your method breakpoint example, you would need to set a chained breakpoint, as in "don't break until this other breakpoint above the chain has been hit", otherwise the breakpoint in the method won't be "spatially" relevant to the code you're debugging.
I've found that the constraint of thinking in chains forces me to think of the recipe that I need for my data. Of course, not everything can be done in a stepwise manner (.pipe helps with that), but often, this constraint forces you to think about what you are doing.
Every good Pandas user I know uses it this way. I've taught hundreds more. Generally, it feels weird at first (kind of like whitespace in Python), but after a day, you get used to it.
Do you store intermediate results of SQL?