推荐学习书目
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
PyPog
V2EX  ›  Python

Python fabric 重写方法

  •  
  •   PyPog · Nov 10, 2015 · 2929 views
    This topic created in 3869 days ago, the information mentioned may be changed or developed.

    遇到一个问题,想请教一下大家。

    Python fabric 中能重写方法吗,我找了好久都没有找到。

    谢谢。

    6 replies    2015-11-13 16:42:54 +08:00
    lins05
        1
    lins05  
       Nov 10, 2015
    没明白“重写”是指什么
    SmiteChow
        2
    SmiteChow  
       Nov 10, 2015
    mock
    PyPog
        3
    PyPog  
    OP
       Nov 12, 2015
    @lins05 我的情况是这样的,我写了一个 fabric 的 module ,我在其他的 fabric 脚本里边导入了这个 module ,但是 module 里边有个方法不能实现,而我又不能改 module 里的方法,所以我问一下,在我写的 fabric 的脚本里边能不能重写 module 里边存在的方法。
    PyPog
        4
    PyPog  
    OP
       Nov 12, 2015
    @SmiteChow 我去查查
    PyPog
        5
    PyPog  
    OP
       Nov 13, 2015
    已经找到

    ```python
    @task(alias = 'method name)'
    def ...
    ```

    这时再`fab -l`就能看到了
    PyPog
        6
    PyPog  
    OP
       Nov 13, 2015
    这回复不支持 markdown 的呀
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1407 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 16:46 · PVG 00:46 · LAX 09:46 · JFK 12:46
    ♥ Do have faith in what you're doing.