Hacker News new | ask | show | jobs
by 63 1269 days ago
I often find myself typing

  python3
  import some_module
  dir(some_module)
rather than trying to find functionality on the docs sites anymore
2 comments

Lately i've been using ChatGPT for that instead and it's phenomenal. Previously, I'd just open up my site-packages folder in a dedicated Sublime window and just search the source code for what I wanted to know.
If you haven't already or aren't aware, install IPython, use ipython3 as a replacement REPL and use the '?' or '??' operators to open the docs/definitions of the object you want to inspect.

    ipython3
    import some_module
    some_module?
    # or
    some_module??
You can also type the object's name and hit tab to get a drop-down menu that will list its methods and attributes, like dir() with a better UX. Modules are objects, too.
> If you haven’t already or aren’t aware, install IPython, use ipython3 as a replacement REPL and use the ‘?’ or ‘??’ operators to open the docs/definitions of the object you want to inspect.

you can read the docs in the standard REPL with help(object).

And, of course, IDEs (or editors with decent Python support plugins) will do it on hover.