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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With