推荐学习书目
› 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 · 4014 views
    This topic created in 4277 days ago, the information mentioned may be changed or developed.
    4 replies  •  2015-02-20 16:42:15 +08:00
    Melodic
    Melodic
    Feb 19, 2015
    1
    判断类型-->执行 --> 检查类型 --> 返回值
    |
    ->触发异常

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