V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
zywscq
V2EX  ›  Python

Python 的类型提示越来越复杂了: Python3.13 又引入了类型注解新特性

  •  
  •   zywscq · 6 小时 6 分钟前 · 1645 次点击

    作为一个老 Python 开发,看了这篇 3.13 的类型注解新特性解读之后,头有点冷: https://medium.com/techtofreedom/7-new-typing-features-in-python-3-13-58caae5f2f10?sk=6ee66766ba372ea1f62b44a0ef08012d

    14 条回复    2024-09-29 11:08:06 +08:00
    passive
        1
    passive  
       5 小时 23 分钟前 via Android   ❤️ 6
    Whatever the world was like when I was 20 is perfect, everything before that is too old, everything after that is too new.
    billccn
        2
    billccn  
       3 小时 31 分钟前
    这些功能在很多其他语言里面都有,但非要取个跟其他语言都不一样的名字。。。
    tairan2006
        3
    tairan2006  
       2 小时 42 分钟前
    还好,反正 type hint 本来就是可选的

    但是这玩意我是真记不住…
    dragondove
        4
    dragondove  
       2 小时 25 分钟前
    @billccn 没明白是指哪几个特性,在其他语言里等价的概念是什么
    june4
        5
    june4  
       2 小时 20 分钟前   ❤️ 1
    以前写 py 还是没有类型注解的时候,现在一看 py 的类型好奇怪的样子,类型竟然还是具体的可导入可操作的实际对象,感觉是拿现成的锤子做了把剪刀,写多了 typescript 不知道 py 这种类型写起来是什么感觉,有没有类型体操
    zcf0508
        6
    zcf0508  
       2 小时 13 分钟前 via Android
    crackidz
        7
    crackidz  
       2 小时 2 分钟前
    还好吧,也没多很多很复杂的东西啊
    wangee
        8
    wangee  
       1 小时 42 分钟前 via iPhone
    如果只是这篇 blog 里面的东西,感觉没有添加太多东西
    panxi
        9
    panxi  
       1 小时 36 分钟前
    @zcf0508 好东西啊 大兄弟
    clino
        10
    clino  
       1 小时 30 分钟前
    等 AI 编程助手都支持了是不是就不太成为负担了
    nyxsonsleep
        11
    nyxsonsleep  
       1 小时 4 分钟前
    @june4 #5 python 类型是可选的,体验还是比 ts 好一点的。
    Hookery
        12
    Hookery  
       38 分钟前
    动态语言在向静态语言贴贴,静态语言在向动态语言贴贴,啥时候整个大一统好了。。
    kneo
        13
    kneo  
       30 分钟前 via Android
    逆水行舟,不进则退。
    est
        14
    est  
       11 分钟前
    别的还好,就是 TypeIs 太 2 了。。。还不如做多态和 multi-dispatch 。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5302 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 03:19 · PVG 11:19 · LAX 20:19 · JFK 23:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.