python3 新特性这么多,你常用的是什么?

2020-10-09 10:43:11 +08:00
 Te11UA
每一个大版本新特性有很多,但实际上工程中倒是用得很少,想问问大伙儿用得比较顺手的新特性都有哪些呢?
6566 次点击
所在节点    Python
50 条回复
yaoye555
2020-10-09 10:46:06 +08:00
3 不是启用很久了么,目前我们生产上用的是.6 上下兼容的挺不错
676529483
2020-10-09 10:55:16 +08:00
type hint,偶尔用:=
lithiumii
2020-10-09 10:57:43 +08:00
开始用 py 之后更新的特性里用最多的是 f string,但那也是好久之前的特性了,3.8 里的 :=偶尔用
linvaux
2020-10-09 10:59:52 +08:00
@676529483 type hint +1,我们还在用 3.7 海象运算符没法用
Te11UA
2020-10-09 11:11:32 +08:00
@yaoye555 指的是 py3 的每一个大版本 比如说 3.8 的 cached_property 啥的
wayslog
2020-10-09 11:15:59 +08:00
type hint 。。。海象基本不用。。。
mashpolo
2020-10-09 11:15:59 +08:00
f-string,少写了不少代码,挺方便的
xiaolinjia
2020-10-09 11:16:25 +08:00
type hint,dataclass
smgui
2020-10-09 11:18:26 +08:00
type hint 和 f-string,应该大多数人都是这两个
ideacco
2020-10-09 11:21:06 +08:00
f-string 是挺方便的
TimePPT
2020-10-09 11:23:48 +08:00
f-string +1
aladdindingding
2020-10-09 11:24:38 +08:00
asyncio 吧 python2 gevent 文档太少
hyperbin
2020-10-09 11:34:06 +08:00
typing dataclass f-string
rglee
2020-10-09 11:39:36 +08:00
f-string 用的最多,type hint 也会用
soraping
2020-10-09 11:40:12 +08:00
f-string 和 type hint 就这两个最顺手
lithbitren
2020-10-09 11:40:38 +08:00
f-string 是真的多,:=过了新鲜期就不咋用了
whileFalse
2020-10-09 12:00:56 +08:00
map 可以保持顺序这点挺好的。
wuwukai007
2020-10-09 12:19:25 +08:00
f 可以嵌套写 f,确实不错
yaoye555
2020-10-09 12:25:05 +08:00
@Te11UA 哈哈,那必须是 f-string 比%好用太多,其他的都没什么刚需
dalei
2020-10-09 12:28:08 +08:00
f-string type-hint asyncio

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/713227

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX