When building a working example of a class, I ended up with the following statements which is violating the 80 character rule of PEP8. The code was inside a method inside a class.
Code excerpt is from
PrettyTable.add_column() in my answer to Using changeable column formatting to display table. Have however left out some of the surrounding code to make it easier to get better reviews:
class SomeClass(): def some_method(self): if self._replace_space_char == None: self._replaced_column_separator = self._column_separator else: self._replaced_column_separator = self._column_separator.replace(' ', self._replace_space_char) self._header_text.append(self.HEADER_PART.format(title, header_alignment, width, self._replaced_column_separator))
Do you have any suggestion as to how to make this readable, and still maintain good variable names and legal Python code? I'm especially interested in how to fold/wrap/... when the construct
self._variable_name.some_method() is by it self in excess of 30-50 characters.