Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PEP8 for long method's name [duplicate]

What is the PEP8 correct way for long method's name? I have a unit test with a self-describing method:

def success_if_buying_price_item_when_participating_and_progression_is_100_percent(self):

But unfortunately this (too long?) method reaches the 80 characters line limit.

Should I rename it and add a description in code or there is an other way?

like image 650
bagage Avatar asked Nov 14 '13 17:11

bagage


People also ask

Which choice is PEP 8 compliant as the name of a class?

I try to adhere to the style guide for Python code (also known as PEP 8). Accordingly, the preferred way to name a class is using CamelCase: Almost without exception, class names use the CapWords convention.

Which of the following styles does PEP8 recommend for multi word variable names?

As mentioned, PEP 8 says to use lower_case_with_underscores for variables, methods and functions.

How long should variable names be Python?

By convention, variable names start with a lower case character. The easiest way to make sure you are not adding lines longer than 80 characters wide is to always work inside a window that is exactly 80 characters wide. If your line starts wrapping around to the next line, its too long.


1 Answers

Should I rename it and add a description in code or there is an other way?

Yes, rename it and add a description. This code is dangerous, one could fall from its chair while another could have a heart attack. Please, rename that ASAP, you don't want to feel responsible.

like image 193
Maxime Chéramy Avatar answered Oct 04 '22 15:10

Maxime Chéramy