[Python-ideas] PEP 8 update on line length
Jonathan Fine
jfine2358 at gmail.com
Fri Feb 22 12:37:46 EST 2019
Raymond Hettinger posted a helpful example to this list. Here, I run
his example, and a variant, through https://black.now.sh
Raymond
class Frabawidget:
@wozzle.setter
def wibble(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)
black.py
class Frabawidget:
@wozzle.setter
def wibble(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)
Raymond variant
class Frabawidget:
@wozzle.setter
def wibble(self, woozle):
if not (self.min_woozle < woozle < self.max_woozle <
self.super_max_value) and do_this_or_that_():
raise ValueError(f"Expected woozle to be between
{self.min_woozle} and {self.max_woozle}")
self._wozzle = normalize(woozle)
black.py
class Frabawidget:
@wozzle.setter
def wibble(self, woozle):
if (
not (
self.min_woozle
< woozle
< self.max_woozle
< self.super_max_value
)
and do_this_or_that_()
):
raise ValueError(
f"Expected woozle to be between {self.min_woozle} and
{self.max_woozle}"
)
self._wozzle = normalize(woozle)
(By the way, I had to add the 'wibble' to the code above, to avoid a
syntax error.)
--
Jonathan
More information about the Python-ideas
mailing list