Reputation: 14038
I've been skimming the Python documentation, but can't seem to find specific details like the above. Where are such details listed?
Upvotes: 1
Views: 973
Reputation: 91009
Since you want the documentation, the below is the closest thing to documentation I could get.
From Python documentation - -
The Python interface is a straightforward transliteration of the Unix system call and library interface for sockets
And from Unix documentation for recv , under the section Return value -
When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional "end-of-file" return).
And when you convert the 0 to a bytes object, you get an empty bytes object. Example -
>>> bytes(0)
b''
Upvotes: 2