简体   繁体   English

pydoc说,“不是所有文件对象都是可搜索的”怎么可能?

[英]How can it be that “not all file objects are seekable”, according to pydoc?

I ran "pydoc file.seek" and this line from documentation puzzled me. 我运行了“ pydoc file.seek”,文档中的这一行让我感到困惑。 "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? 怎么会有一个不可搜索的文件对象?

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. 除非您自己保存了信息,否则您将无法返回并从五分钟前重新获得客户对您的答复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM