print "hello world" 多好

2017 年 1 月 4 日
 Gem
python3 其他改进还好,就是这个 print ,设计成函数 print("hello world"),感觉不简洁了。
3635 次点击
所在节点    Python
10 条回复
fatestigma
2017 年 1 月 4 日
恩。一开始我也这么觉得。但是习惯了也还好。
你可以看看几个讨论:
https://www.reddit.com/r/Python/comments/45vok2/why_did_python_3_change_the_print_syntax/
https://news.ycombinator.com/item?id=10822804
官方基本在 3.0 的介绍里都会把「 Print Is A Function 」放第一个。
guyskk
2017 年 1 月 4 日
设计成函数方便传参数控制输出格式,也可以 from pprint import ppring as print 这样,总结起来就是增加灵活性减少暗坑
leavic
2017 年 1 月 4 日
等你要把 print 作为回调函数的时候你就知道这个改进有多好了
msg7086
2017 年 1 月 5 日
你要简洁为什么还要用 Python ?
Gem
2017 年 1 月 5 日
@msg7086 OK, let's ruby... and on rails!
nicegoing
2017 年 1 月 5 日
IDE 不帮你干好了吗?自动补全。
littleshy
2017 年 1 月 5 日
感觉还是函数调用不需要括号爽。
zjyjer
2017 年 1 月 5 日
@littleshy Haskell 大法好
littleshy
2017 年 1 月 5 日
@zjyjer Ruby, Elixir, F# 都不用呀。
ferstar
2017 年 1 月 5 日
习惯就好, 反正为了 Python3 可以无视 u"哈哈"这一条打死我都要上船

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

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

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

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

© 2021 V2EX