On 2010-07-23, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote: > On Thu, 22 Jul 2010 20:18:43 -0700, march wrote: > >> Hi, guys. >> >> As a regular user of python, I am often annoyed by the fact that the >> official python docementation is too short and too simple to satisfy my >> requirement. > > Python is a volunteer effort. If the docs don't suit your requirements, > we're grateful for patches. > >> While working with socket, I want to know every detail about every API. >> I can easilly achieve that by reading man page if the language is C. But >> It seems that the Python story is different. > > Python is open source. Where the documentation is silent, the ultimate > authority is the source code. Particularly if the code is a thin wrapper > around the C library, which I expect (but don't know for sure) the socket > code will be. > > >> For the interface recv(), all I got is only three sentences. " >> Receive data from the socket. The return value is a string representing >> the data received. The maximum amount of data to be received at once is >> specified by bufsize. " >> http://docs.python.org/library/socket.html#socket.socket.recv >> >> What if the call fail? > > You will get an exception, just like the page says: > > All errors raise exceptions. The normal exceptions for > invalid argument types and out-of-memory conditions can be > raised; errors related to socket or address semantics raise > the error socket.error. > > >> What if the peer close the socket? > > You will get an exception,
Nope. You read a value of "". > just like the Fine Manual says. If it does say that, it needs to be fixed. >> I hate this documentation! Then quit bitching and submit a patch. > Don't blame the documentation for your failure to read it. It's true > that it could be improved, but most of your questions were answered > by the page you linked to. -- Grant Edwards grant.b.edwards Yow! I am having FUN... at I wonder if it's NET FUN or gmail.com GROSS FUN? -- http://mail.python.org/mailman/listinfo/python-list