V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
phuslu
V2EX  ›  Python

一个使用gevent实现的异步读写文件的模块

  •  
  •   phuslu · 2012-03-10 01:56:11 +08:00 · 5908 次点击
    这是一个创建于 4421 天前的主题,其中的信息可能已经有所发展或是发生改变。
    起源与我在水木上参与的一个讨论:
    http://www.newsmth.net/bbstcon.php?board=Python&gid=87159

    到现在已经完成了,实现很简单,不过还是比较好用的。
    https://github.com/phus/gevent-asyncfile
    4 条回复    1970-01-01 08:00:00 +08:00
    phuslu
        1
    phuslu  
    OP
       2012-03-10 16:32:41 +08:00
    从PyCon 2012看来,今年应该是gevent的爆发年。
    https://www.google.com/search?hl=zh-CN&q=gevent+site%3Apycon.org

    这点在近期python-cn社区的讨论中也可以得到印证。
    ayanamist
        2
    ayanamist  
       2012-03-12 10:21:37 +08:00
    我怎么看了看代码,觉得这种异步的方式对性能不会有提高。
    另外用了fcntl,应该就放弃支持Windows了。所以目前真正的跨平台异步方案似乎还是只有NodeJS(在Win上用了IOCP)
    hewigovens
        3
    hewigovens  
       2012-03-12 10:51:19 +08:00
    1楼的链接404了
    phuslu
        4
    phuslu  
    OP
       2012-05-12 02:36:21 +08:00
    最新的gevent版本已经加入gevent.fileobject,实现手法和这个是一样的。呵呵。
    https://bitbucket.org/denis/gevent/changeset/131b2c510bb8
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1165 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:22 · PVG 02:22 · LAX 11:22 · JFK 14:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.