PEP8 - 80 个字符 - 大整数
这在某种程度上与有关大字符串和 PEP8 的问题相关。
如何使我的脚本具有以下行 PEP8 兼容(“最大行长度”规则)?
pub_key = {
'e': 3226833362680126101036263622033066816222202666130162062116461326212012222403311326222666622610430466620224662364142L,
'n': 226421003861041248462826226103022608220328242204422684232640331238220232226321616266146243302342688266846281802662666622213868114632268211186223606846623310006662260110460620201618186828411322260686632603226636226662262862212140221422102106336342228236361106240226122644614266186283436228208626640846820224661642086022346422443282224682686612228404266842316822624342226666622264826123822122031361242246432886612624262663222232331438863220022020826266366016100422L
}
This is somehow related to question about big strings and PEP8.
How can I make my script that has the following line PEP8 compliant ("Maximum Line Length" rule)?
pub_key = {
'e': 3226833362680126101036263622033066816222202666130162062116461326212012222403311326222666622610430466620224662364142L,
'n': 226421003861041248462826226103022608220328242204422684232640331238220232226321616266146243302342688266846281802662666622213868114632268211186223606846623310006662260110460620201618186828411322260686632603226636226662262862212140221422102106336342228236361106240226122644614266186283436228208626640846820224661642086022346422443282224682686612228404266842316822624342226666622264826123822122031361242246432886612624262663222232331438863220022020826266366016100422L
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
source
在这种情况下,我将保留大整数不变。
source
In this case, I would just leave the big integers as is.
我绝不赞同这一点。
I in no way endorse this.
我能想到的最好的办法就是
80个字符。
best way I can think of is
exactly 80 chars.
我认为你不能。 PEP8 中的指南只是指南,在某些情况下无法遵循该指南。
I don't think you can. The guidelines in PEP8 are guidelines, there are situations where it's just not possible to follow the guideline.
导入这个
import this
这是可以做到的。通过将表达式括在括号中,可以将长行分成多行。这是解释的地方:
http://www.python.org/dev/peps /pep-0008/
This can be done. Long lines can be broken over multiple lines by wrapping expressions in parentheses. Here is where it is explained:
http://www.python.org/dev/peps/pep-0008/