Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrapping method name in definition

Is it possible to wrap the method name in the definition of a function? I have an exceptionally long method name and I'm wondering if it's possible to wrap it like so:

# method name is my_really_long_method_name_wow_this_is_really_long
def my_really_long_method_name_
        wow_this_is_really_long():
    pass

I have tried doing this, but I get a syntax error:

def my_really_long_method_name_\
        wow_this_is_really_long():
    pass
like image 290
Jack Wilsdon Avatar asked Oct 19 '22 02:10

Jack Wilsdon


1 Answers

No, wrapping your function name is not possible, even if Python supports unlimited length of function names. Longer function names are not unusual, but making them so long they need two rows of a screen actually shows something is really wrong with your naming convention.

Btw, Python recommends a line length (in total) of 79 characters. We are not in the 80's anymore with old screens so you can ignore that limit, but it gives you a good indication.

Reference: PEP 0008 -- Style Guide for Python Code

like image 176
HelloWorld Avatar answered Oct 21 '22 16:10

HelloWorld