![]() |
|
![]() |
| These kinds of tools are useful.
Twenty years ago I wrote an object introspector for Zope ;) Nowadays, I'm using devtools daily, and icecream and q occasionally. I'll give wat a try. |
![]() |
| This looks super useful, but I was wondering if I'm the only one bothered by this recent trend of overloading completely unrelated operators (here the `/` operator) in the name of legibility. |
![]() |
| I do agree overloading / is an odd choice in this instance, but it’s a shame “is” can’t be overloaded! Realistically wat(foo) would be fine though. |
![]() |
| Check out the module “q”! It’s callable, its author talked about how great it would be to have a module level __call__ because the way it was made callable is super wonky. |
![]() |
| One might suggest adding:
to your $PYTHONSTARTUP file to avoid the cumbersome import. |
![]() |
| I wonder if there's something like this for Lua. It doesn't have Python's built-in conveniences for introspection like `help()`. |
![]() |
| Looks great! And it would make for a great addition to Jupyter lab. I actually can't believe there is still no decent variable explorer bundled in |
![]() |
| >Given the natural built-in introspection capabilities of the language, I never understood why something like that wasn't also a built-in part Python.
Somthing like that does exist, and has, from Python 2.x; the inspect module, apart from help() and dir(): It is somewhat lower-level than wat, which builds upon it. But it is powerful. https://news.ycombinator.com/item?id=41072878 Or did you mean the inspect module itself? |
![]() |
| Maybe it's just me but I just use a proper debugger. Debugpy and VSCode work fantastically.
In a previous company I set things up so that when there's an uncaught exception it will automatically start a VSCode debug session and connect to it. Here's the extension: https://github.com/Timmmm/autodebug/ Unfortunately the Python part of that is not open source but it was only a few lines of code - should be easy to recreate. That repo does contain a C library that does a similar thing. You might just say "why not just run your program directly with the debugger?" and yeah that is better when you can do it, but I'm working with complicated silicon verification flows that are often several layers of Python and Make, followed by a simulator (e.g. Questa or VCS) that itself loads the library you want to debug. Very difficult to make debugging work through all those layers, but it's quite easy to write some code at the bottom of the stack that says to a debugger "I'm here, debug me!". |
![]() |
| Right, that would be a wrong pipe direction. Fun fact: It's already possible to do "wat | foo" or "wat << foo" (if you're more familiar with C++ iostream), it has the same effect as "wat / foo" |
![]() |
| 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. |
I'm also really appreciating the base64 exec hack. All my years in Python I never thought of or came across it until now. I'll totally be using it for some things :).
[0] https://github.com/gabrielcnr/python-ls [1] https://pypi.org/project/snoop/