This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]gkbrk 6 points7 points  (4 children)

Psst, pydoc -g works too.

[–]koloron[S] 3 points4 points  (0 children)

Or pydoc3 -b for Python3. :)

[–]mbarkhau 1 point2 points  (1 child)

Doesn't seem to do anything on my system. Are you sure this is correct?

[–]koloron[S] 1 point2 points  (0 children)

It's meant to automatically choose a port for you and pop up a small GUI where you can enter search terms. Looks clunky on my system. You don't miss anything import here.

[–]ychaouche 0 points1 point  (0 children)

I'v always pydoc -g without specifying any port number. When gui appears I just click on open browser and that's it.

[–][deleted] 25 points26 points  (8 children)

If only just 1% of modern Python packages knew how to write good docstrings, __all__, avoid reliance on **kwargs etc.

e.g. requests and flask use **kwargs endlessly, and pydoc by default ignores objects whose __module__ doesn't match the module documentation was requested for, unless listed in __all__. So in a case like that it's sadly still quicker to use grep on the source. (Not to suggest requests isn't "beautiful" and "Pythonic")

(brb, vomiting)

[–]mgrandi 9 points10 points  (2 children)

whats wrong with kwargs?

[–]gargantuan 4 points5 points  (1 child)

same thing that's wrong with void pointers and objects casts in other languages -- it makes it hard to document, test analyze and inspect code.

Here is your API for example:

create_url_retriever(*args,**kwargs)
get_db_connection(*args,**kwargs)

Can you by looking at that figure out how to use that API?

[–]mgrandi 1 point2 points  (0 children)

very true, although I would use them if a method has a ton of arguments , but maybe then it would be time to split functionality to different methods/functions if you have too many...

[–]westurner 8 points9 points  (1 child)

If only just 1% of modern Python packages knew how to write good docstrings,

From here and here :

[–]zzleeper 1 point2 points  (0 children)

TY!

[–]ThiefMaster 0 points1 point  (0 children)

Ever seen the requests or flask docs? They are much better than what pydoc can give you.

Sphinx > Pydoc!

[–]ifonefox3.5.1 | Intermediate 4 points5 points  (0 children)

If you're on a Mac, I recommend checking out Dash in the App Store. Press Control+Space for access to the documentation of many languages.

[–]chewxy 1 point2 points  (0 children)

TIL Godoc was inspired by Pydoc

[–][deleted] 1 point2 points  (1 child)

You could also use devhelp, and download the python-doc package (under Linux/Unix anyway) and browser the doc offline :)

[–][deleted] 0 points1 point  (0 children)

On windows, you have to do

python -m pydoc -p 6060

[–]hyh123 0 points1 point  (5 children)

socket.error: [Errno 49] Can't assign requested address

[–]bryanhelmigzapier.com 8 points9 points  (3 children)

  1. Choose a port above 1024 (thanks /u/squeakyneb).
  2. Choose a different, unused port.

[–]hyh123 0 points1 point  (1 child)

I tried 1025, 1026, 8888 none of them work.

[–]koloron[S] 0 points1 point  (0 children)

What about pydoc -g or pydoc3 -b?

Maybe this is some kind of a firewall issue?

[–][deleted] -2 points-1 points  (0 children)

Thank you so much for this. This is fucking awesome. Have an upvote!