[Python-ideas] PEP 8 update on line length

Dan Sommers 2QdxY4RzWzUUiLuE at potatochowder.com
Thu Feb 21 23:01:03 EST 2019


On 2/21/19 7:06 PM, Chris Barker via Python-ideas wrote:
 > On Thu, Feb 21, 2019 at 12:01 PM Raymond Hettinger
 > <raymond.hettinger at gmail.com> wrote:

 >> class Frabawidget:
 >>     ...
 >>     @wozzle.setter
 >>     def (self, woozle):
 >>         if not (self.min_woozle < woozle < self.max_woozle):
 >>             raise ValueError(f"Expected woozle to be between
 >> {self.min_woozle} and {self.max_woozle}")
 >>         self._wozzle = normalize(woozle)
 >>

 > That's 103 chars long -- and very readable. But, is this that much
 > worse?

 > class Frabawidget:
 >      ...
 >      @wozzle.setter
 >      def (self, woozle):
 >          if not (self.min_woozle < woozle < self.max_woozle):
 >              raise ValueError(f"Expected woozle to be between"
 >                                "{self.min_woozle} and {self.max_woozle}")
 >          self._wozzle = normalize(woozle)

I remain against longer lines.  I break 80 characters extremely rarely,
if ever, and at times start breaking long lines before that.  I find
Chris's code more readable.

I'm even more against for backwards incompatibility and hard-to-read
exception messages.  ;-)

Chris's code doesn't quite match Raymond's; Chris lost a space between
(ironically) "between" and "{self.min_woozle}."

Dan


More information about the Python-ideas mailing list