The name of the packaging method in the definition

Is it possible to wrap a method name in a function definition? I have an exceptionally long method name, and I wonder if it can be wrapped like this:

# 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 tried to do this, but we get a syntax error:

 def my_really_long_method_name_\ wow_this_is_really_long(): pass 
+5
source share
1 answer

No, packing the name of your function is not possible, even if Python supports an unlimited length of function names. Longer function names are not unusual, but force them for so long that they need two lines of screen, it actually shows that something is really wrong in your naming convention.

Btw, Python recommends a string length (total) of 79 characters. We are no longer in the 80s with old screens, so you can ignore this limit, but it gives you a good idea.

Reference: PEP 0008 - Style Guide for Python Code

+3
source

All Articles