|
|
|
|
|
by zo1
4094 days ago
|
|
If you'd like my suggestion. I've been quite annoyed with some of the "odd" or "non-consistent" ways for splitting long lines onto multiple lines (either on definitions, or plain calls to functions). Eventually, I did come up with a consistent way to do so. Have a look at below: def OtherLongFunctionName(One,
Two,
Three
):
print "Does stuff"
def MyFunction(Param1,
OtherParam,
FooParam,
EtcParam
):
if ((Param1 * 1000) > 5000 &&
OtherParam is not None &&
len(FooParam) > 50
):
new_instance_dict = {
"TestingFoo": Param1,
"NewFoo": OtherParam,
"LongFooBar": FooParam,
}
recursive = MyFunction(
OtherLongFunctionName(
Param1,
OtherParam,
FooParam
)
)
It doesn't comply to PEP8 due to the indentation of nested params and stuff on the new lines. PEP8 apparently wants them aligned with the opening/starting bracket. This looks horrible, and just right-aligns all your code into little columns. And doesn't work very well with nested function calls. |
|