views:

223

answers:

8

I'm looking for some reference pages for Python similar to PHP.net's documentation. i.e., something that provides a clear, simple list of all the classes and methods within a module that I can click to get more information, such as the arguments. Having descriptions below each class/method makes it harder to find what you're looking for.


Haven't got the answer I'm looking for, so I'm in the process of creating such an index. Version 1 should be ready in a few hours hopefully. link

+2  A: 
>>> import datetime
>>> help(datetime.time)
Ignacio Vazquez-Abrams
+4  A: 

First few lines of the built-in docs seem fine to me:

from datetime import time
help(time)

Prints:

class time(__builtin__.object)
 |  time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object
 |
 |  All arguments are optional. tzinfo may be None, or an instance of
 |  a tzinfo subclass. The remaining arguments may be ints or longs.
Adam Bernier
Well, that's clear and nice... I prefer having a website to using the command-line everytime I want to look something up though. Especially if I don't know the name of what I'm looking for exactly.
Mark
@Mark: use your energy to suggest ways to make the on-line documentation better. How would you organize it?
Adam Bernier
@Adam: I did suggest a way. I said I want a simple list of methods without the descriptions muddled in. I'd put it in a sidebar on either the left or right hand side of the page. Each page would be dedicated to only *one* method, and it would list its arguments clearly at the top, with their defaults. I'd make them clickable anchors which give more info. I'd put examples below that, and then user comments at the bottom of the page. I'd have a search feature that will take you straight to the method.
Mark
@Mark: I think those are good suggestions, and perhaps not so difficult to implement. Maybe you'd like to submit to the e-mail address listed here http://www.python.org/about/website/ and later update your question with any developments.
Adam Bernier
+2  A: 

Personally, I find these two techniques helpful:

  1. Import the module datetime and then doing help(datetime.time). The output is much better and gives mostly what you need.

  2. Using effbot's reference. You can check out the datetime one here. I usually Google Effbot <module> for a short description of the module and a working example. Very helpful in times.

More specifically, this is what I am talking about.

sukhbir
effbot is exact opposite of what I want.. I'm looking for a reference manual, not more tutorials. `help` does work well, but... I don't like having to go into the commandline, import a module, then haphazardly `help` until I find what I'm looking for.
Mark
Aah ok, sorry couldn't be of much help, but I usually look up effbot's website for getting something done quickly without going into the nitty-gritty details. Also, sometimes examples help you understand the documentation. But that is what I feel!
sukhbir
@PulpFiction: Simple examples are great if that's what you're looking for, but not if all you want to know is the arguments. Intellisense in Python doesn't work very well :\
Mark
+2  A: 

The standard online reference manual has a search function that works reasonably well.

The search for datetime linked to above provides a list that includes the contents of the datetime module, methods/properties on the datetime class, several references to datetime from elsewhere in the library, and a bunch of C API references.

Looking in a reference manual presupposes to some extent that you know what you are looking for.

It sounds like maybe you want a list of methods/properties for the class to be displayed in the left-hand nav? If so, it might be worth putting in a request for this to the docs folks to see if it something that could be changed.

bstpierre
Yes... that would be wonderful if they had a list of methods and properties on the left hand side. Otherwise I find myself scrolling through a long page trying to dig out what I want, and with the descriptions mixed it, its easy to skip over what I was looking for. The search seems decent.. I guess it's unfortunate that the first link for "datetime.time" is a method that *doesn't* create a time based on inputs (in fact.. I'm still not sure what it does.."same hour, minute, second".. as what? is that like `now()`?)
Mark
@Mark: "same hour, minute, second" ... as the `datetime` object on which you're invoking `time()`.
bstpierre
+2  A: 

You could try

python -m pydoc -p 8000

then go to http://localhost:8000

Probably still not what you're looking for, but it's another option.

ma3
If it showed the args and hid the `__eq__` methods, it would be half decent. At least it's concise.
Mark
+1  A: 

Perhaps someone should simply use iframes (or actual frames) to put these together:

http://docs.python.org/library ./reference

Maybe take you an hour with BeautifulSoup, re, and urllib2.

I've found Ctrl-f applied to ./library works ok.

JoshN
+1  A: 

Easy-to-navigate python reference manual:

Go to the obvious(?) place -- Python Library manual, datetime module: http://docs.python.org/library/datetime.html

In the table of contents in the panel on the left, notice "8.1.5 time Objects". Click on the link.

Read the top of the page:

class datetime.time(hour[, minute[, second[, microsecond[, tzinfo]]]])

Update OK, so we want "utcoffset" and it's not at the top of the page. Try this in your browser: <Ctrl-F>, type "utcoffset" (without the quotes), <Enter>

Alternative: (may be available only on Windows and Linux) -- a CHM version of the docs is included with Windows Python distributions and I've heard that it can be used on Linux as well. Start it up, click on Index, type "utcoffset" (without the quotes), <Enter> and it'll display three options -- it's a method of datetime.(datetime|time|tzinfo)

John Machin
Yes..and that's what I've been doing (Ctrl+F), but it doesn't seem like it should be necessary. Also "datetime.time" has 20 results. 20! That's hardly efficient.
Mark