gpt4 book ai didi

coding-style - 排队运算符(operator)是一种有值(value)的风格吗?

转载 作者:行者123 更新时间:2023-12-01 07:03:40 25 4
gpt4 key购买 nike

some_var = foo()
another_var = bar()

或者
some_var    = foo()
another_var = bar()

包括在添加或删除行时更改空格以保持它们对齐。这真的好看吗?是否值得搞砸差异?

最佳答案

我不认为这是一种好的样式,因为它使更改变得太难(您必须重新排列它们的所有工作),而且对我而言,它在没有额外空格的情况下是完全可读的。

对此特别烦人的是,当您更改比所有其他行都长的行的左侧部分时,您需要重新排列所有其他行。

例子:

some_var    = foo()
another_var = bar()

现在我想添加一个名为 another_another_var 的变量:
some_var    = foo()
another_var = bar()
another_another_var = baz()

现在我必须再次排列它们:
some_var            = foo()
another_var = bar()
another_another_var = baz()

很烦人。

关于coding-style - 排队运算符(operator)是一种有值(value)的风格吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/285662/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com