V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
leyle
V2EX  ›  Python

python3 中支持值类型,有些时候确实方便

  •  
  •   leyle · Nov 3, 2018 · 2699 views
    This topic created in 2740 days ago, the information mentioned may be changed or developed.
    特别是用别人的包的时候,指定一下类型,ide 在联想时,就很方便了,提高了码代码的效率。
    推荐大家也尝试下。

    这种需要的时候,就有那个功能能够满足,不需要时,也不会打扰,确实美滋滋。
    Supplement 1  ·  Nov 4, 2018
    嗯,就是 PEP484 说的内容。
    [PEP 484 -- Type Hints | Python.org]
    https://www.python.org/dev/peps/pep-0484/
    6 replies    2018-11-05 10:37:18 +08:00
    PythonAnswer
        1
    PythonAnswer  
       Nov 4, 2018 via iPhone
    别人发布包的时候,如果有写,的确是美滋滋。
    cyspy
        2
    cyspy  
       Nov 4, 2018
    就像很多语言引入了 var 和 val,真正需要注明类型的情况并不是绝大多数,同时 duck type 又避免了静态语言一些写起来麻烦的地方。
    congeec
        3
    congeec  
       Nov 4, 2018
    值类型? value type?
    你说的是 type annotation 和 gradual typing 吧
    ltoddy
        4
    ltoddy  
       Nov 4, 2018   ❤️ 1
    PEP 484 type hints?
    atcdef
        5
    atcdef  
       Nov 4, 2018
    类型标注?我也喜欢用,这样方便 ide 自动提示,挺好的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4770 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 01:09 · PVG 09:09 · LAX 18:09 · JFK 21:09
    ♥ Do have faith in what you're doing.