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

python 3.x中,不再有__del__ ?

  •  
  •   vking · Feb 27, 2013 · 4072 views
    This topic created in 4961 days ago, the information mentioned may be changed or developed.
    按照http://sebug.net/paper/python/ch11s06.html的代码,在3.3中测试了一下,发现__del__没有起作用.
    4 replies  •  1970-01-01 08:00:00 +08:00
    reusFork
        1
    reusFork  
       Feb 27, 2013
    __del__不保证会被调用的
    reusFork
        2
    reusFork  
       Feb 27, 2013
    不要看这本书了
    vking
        3
    vking  
    OP
       Feb 27, 2013
    @reusFork 推荐一本,一本即可.
    中文版Python3教程 怎么样?
    BOYPT
        4
    BOYPT  
       Feb 28, 2013
    如果你想要指明它的运行,你就得使用del语句,就如同我们在以前的例子中使用的那样。
    ====

    这句话的描述是错误的,见python document中加了注意框的描述:

    http://docs.python.org/3/reference/datamodel.html#object.__del__
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2418 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 16:04 · PVG 00:04 · LAX 09:04 · JFK 12:04
    ♥ Do have faith in what you're doing.