Reputation: 103
I ran "pydoc file.seek" and this line from documentation puzzled me. "Note that not all file objects are seekable." As far as I understand, "not seekable" means "you can't use seek, even if you have access permission". I don't understand, how is it even possible? How can there be a file objects that can't be seekable?
Upvotes: 0
Views: 1083
Reputation: 189739
A file on disk is always seekable, but the file handle abstraction does not apply only to files on a local disk. Unidirectional information streams like pipes, network sockets etc are only there for you as long as you keep them buffered or in memory; unless you have saved the information yourself, you cannot go back and refetch a client's response to you from five minutes ago.
Upvotes: 2