
Unlike the other scripting languages I work with(like PHP, Ruby, JavaScript, etc.), I am not comfortable using Python. I have made some stuff in Python(for example, frees) - but I could get into the flow as easily as with other languages. For the longest time, I thought it was because of the whitespace issue. But recently, I created a small Python script - that’s when I understood that whitespace does not concern me. What make me angry at python is its documentation/manual.
By Python Manual, I mean the official Python Manual available at http://docs.python.org/. I have downloaded the entire manual to my system as HTML files and use that as a reference when working with Python. This is what I have done for all the other languages I work with…
Finding a Function
There is one big problem with using HTML files as your reference - you cannot search through it. So I try to find a page in the documentation that lists all the functions in a single page. When I need to find a function, all I have to do is search through this page. These pages in the documentation serves this purpose…
What about Python? Well, Python don’t have such a page in their manual. The nearest one I could find a combination of four pages - Module Index + Library Index + Tutorial Index + Language Index. Its no where near as useful.
Even if you are online(remember, many people are not connected all the time), its still not easy to find a function in Python documentation - even with searching capabilities. Don’t believe me? OK - go to Python Docs and try to find the documentation for the function that, say, reverses an array. Now go to the PHP site and do the same.
Reference Formats
Anyway, I cannot really complain about the the availability of the ‘function page’. Its just the way I prefer - other people may not want such a page. But I can complain about the fact that they don’t provide a CHM file in their downloads section. CHM solves the problem as you can search through them easily.
PHP, on other hand, provides the CHM file. This makes the PHP manual much more easier to use.
Even though Python don’t officially provide a CHM file, others have made it available on the net. Its just a google search away. But I prefer to get these stuff from an official source.
Level of Detail in the Documentation
The worst sin of the Python manual is that the documentation is not detailed enough. To better understand this, let’s take an example - say the array reversal function. First we take a look at the Python documentation for this function…
- reverse()
- Reverse the order of the items in the array.
One line. That’s it! If you are not well versed in Python, you will have no idea of how to use this function - because there is no example. Most people will expect that the array must be given as the argument. But the argument list is empty in the documentation. That’s because the array is not passed as an argument - rather, in Python, this function is a member function of the array object - so the proper usage will be something like this…
x = [1,2,4]
x.reverse()
#Now x has the value [4,2,1]
I know that because I know Python - but if a new user manages to find the documentation for this function, he will be confused. Another thing - I am not saying that there are no examples in the documentation - examples are given for a lot of functions. But its no where near the level that PHP has achieved.
OK - now lets see the PHP manual for the same function - array_reverse(). There is an entire page for that function. Not just for this function - there is one page of documentation for every function in PHP. And there are examples. And at the end, there is a collection of ‘user notes’ - making each function much clearer. Beautiful!
I feel a bit guilty about comparing Python with PHP documentation - PHP has the best documentation in its class of languages. But still, Python has a lot to learn from PHP(I wanted to say that for a long time
).