问题描述
为什么在这个千年中,Python 指定一个为79个字符?
Why in this millennium should Python PEP-8 specify a maximum line length of 79 characters?
几乎所有在阳光下的代码编辑器都可以处理更长的行。包装应该由内容消费者选择,而不是内容创建者的责任。
Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the responsibility of the content creator.
在这个时代,有没有(正当的)合理理由坚持使用79个字符?
Are there any (legitimately) good reasons for adhering to 79 characters in this age?
推荐答案
PEP-8的大部分价值在于阻止人们争论无关紧要的格式化规则,并继续写出好东西,格式一致的代码。当然,没有人真的认为79是最佳选择,但是将其更改为99或119或您首选的行长都没有明显的好处。我认为选择是这些:遵循规则并寻找值得争取的理由,或提供一些数据来证明可读性和生产率如何随行长而变化。后者将非常有趣,而且我很有可能改变人们的想法。
Much of the value of PEP-8 is to stop people arguing about inconsequential formatting rules, and get on with writing good, consistently formatted code. Sure, no one really thinks that 79 is optimal, but there's no obvious gain in changing it to 99 or 119 or whatever your preferred line length is. I think the choices are these: follow the rule and find a worthwhile cause to battle for, or provide some data that demonstrates how readability and productivity vary with line length. The latter would be extremely interesting, and would have a good chance of changing people's minds I think.
这篇关于为什么PEP-8指定的最大行长为79个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!