Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当一行代码太长时,如何在没有\_Python_Python 2.7_Python 3.x_Pep8 - Fatal编程技术网

Python 当一行代码太长时,如何在没有\

Python 当一行代码太长时,如何在没有\,python,python-2.7,python-3.x,pep8,Python,Python 2.7,Python 3.x,Pep8,我创建了一些类,但这些类的名称太长(eq:negativechannelmetaloxidasemiconductorfieldeffecttransistor)。我想用python中的\创建一个新行,但在本例中,它很难看。一般来说,在Python中,当代码太长时,使用\生成新行是一个不错的选择,但在这里不起作用。我应该如何缩短或拆分这些行 关于在不使用\的情况下缩短此行的一些建议: class NegativeChannelMetalOxideSemiconductorFieldEffect

我创建了一些类,但这些类的名称太长(eq:
negativechannelmetaloxidasemiconductorfieldeffecttransistor
)。我想用python中的
\
创建一个新行,但在本例中,它很难看。一般来说,在Python中,当代码太长时,使用
\
生成新行是一个不错的选择,但在这里不起作用。我应该如何缩短或拆分这些行


关于在不使用
\
的情况下缩短此行的一些建议:

class NegativeChannelMetalOxideSemiconductorFieldEffectTransistor(MetalOxideSemiconductorFieldEffectTransistor):
无需使用
\
,就可以在大括号
[]
{}
()
内断开一行

class NegativeChannelMetalOxideSemiconductorFieldEffectTransistor(
    MetalOxideSemiconductorFieldEffectTransistor):
您可以使用首字母缩略词或缩写:

class NegativeChannelMetalOxideSemiconductorFET(MetalOxideSemiconductorFET):
或:


不要链接到代码的图像。相反,请将代码的文本直接复制到您的问题中,格式正确。谢谢您回答我的问题,我想我已经知道遇到类似问题时该怎么办了
class NegativeChannelMOSFET(MOSFET):