Re:Show HN: Wat – Deep inspection of Python objects
by languagehacker on Thursday July 25, 2024 @01:57PM
(#41071446)
This is interesting. I'm wondering what compelled the author to use the division magic method for arguments instead of the more intuitive and commonly used approach to passing parameters.
[ Parent
| on HN ]
Re:Show HN: Wat – Deep inspection of Python objects
by enragedcacti on Thursday July 25, 2024 @02:09PM
(#41071570)
I think it makes a lot of sense in the context of a live interpreter. Wrapping and object in help() or dir() is an annoying set of movements vs. just pressing 5 keys with no modifiers (Home, w,a,t,/). It makes its feel much more like a magic command without actually needing it to be magic. The dot modifiers are also convenient compared to passing kwargs imo.
Re:Show HN: Wat – Deep inspection of Python objects
by lakshayg on Thursday July 25, 2024 @02:08PM
(#41071554)
Interesting choice indeed. It looks like it supports the traditional approach as well
> wat object can quickly inspect things by using the division operator (to avoid typing parentheses). A short, no-parentheses syntax wat / object is equivalent to wat(object).
Re:Show HN: Wat – Deep inspection of Python objects
by pvg on Thursday July 25, 2024 @03:29PM
(#41072422)
The README suggests for easier typing in interactive use.
Re:Show HN: Wat – Deep inspection of Python objects
by igrek51 on Thursday July 25, 2024 @05:50PM
(#41073762)
It's the parentheses that drove me crazy. As people already noted, it's for faster typing, at the cost of the division magic as you noted. If it's more familiar to you, it works with `wat(object)` syntax as well.