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

用 Python 自身如何实现 int()、set()、str()这些工厂函数

  •  
  •   Rorschach · Feb 19, 2015 via Android · 3993 views
    This topic created in 4261 days ago, the information mentioned may be changed or developed.
    4 replies  •  2015-02-20 16:42:15 +08:00
    Melodic
        1
    Melodic  
       Feb 19, 2015
    判断类型-->执行 --> 检查类型 --> 返回值
    |
    ->触发异常

    type和isinstance()可以用嘛?
    est
        2
    est  
       Feb 20, 2015 via Android
    PyObject里随便撸
    dant
        3
    dant  
       Feb 20, 2015 via iPhone
    str(obj) -> obj.__str__()
    geew
        4
    geew  
       Feb 20, 2015
    3楼说得很对 python里面 万物皆对象 楼主所说的工厂函数在每个对象里面都有自己的实现
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3099 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 14:55 · PVG 22:55 · LAX 07:55 · JFK 10:55
    ♥ Do have faith in what you're doing.