[Python-ideas] docs.python.org: Short URLs

Chris Angelico rosuav at gmail.com
Mon Feb 17 15:34:25 CET 2014


On Tue, Feb 18, 2014 at 12:12 AM, Markus Unterwaditzer
<markus at unterwaditzer.net> wrote:
> What i actually wanted to suggest is a convenience feature that is available at
> php.net: http://php.net/str_replace directly shows the documentation of PHP's
> str_replace. Concretely, I propose that, for example,
> http://docs.python.org/2/str redirects to the documentation for `str` in Python
> 2 , while http://docs.python.org/3/str, http://docs.python.org/str and/or
> http://python.org/str redirect to the documentation for `str` in Python 3. Here
> is a simple script that roughly shows how i would expect this redirect to
> resolve the given object names:

I like the idea, but your URLs might conflict with other things. Would
it be too awkward if namespaced?

http://docs.python.org/[ver]/kw/str

and then have a keyword index (hence "kw", which is nice and short)
which could have function/class names, common search keywords, a few
aliases (regex -> re), etc, etc.

Pushing those sorts of URLs would help with the ease of finding docs,
though. Usually when I want to look up something specific, it takes me
two or three clicks _after_ a Google search.

(Mind you, a lot of the linked-to rant about listing error conditions
won't ever happen in Python, because Python is not PHP. You can list
every error return from a PHP function *because every one of them had
to be coded in explicitly*. How can you list every exception a Python
function might throw back at you? You'd have to recurse into
everything that function calls, and see what they might raise. And
that requires knowing the types of every object used, including those
passed in as parameters... so, pretty much impossible.)

ChrisA


More information about the Python-ideas mailing list