【发布时间】:2015-05-07 22:52:39
【问题描述】:
有时在 Python 中包含三元运算符的行会变得太长:
answer = 'Ten for that? You must be mad!' if does_not_haggle(brian) else "It's worth ten if it's worth a shekel."
有没有推荐的方法来使用三元运算符在 79 个字符处换行?我在PEP 8 中没有找到它。
【问题讨论】:
-
把它放在括号里。
标签: python line-breaks