> On Feb 21, 2019, at 5:06 PM, Chris Barker via Python-ideas 
> <python-ideas@python.org> 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)
>  
> (it IS harder to write, that's for sure)

Yes, it's worse.  You introduced twos bugs.  First the space between the two 
fragments was lost.  Second the f on the second f-string was dropped.  I see 
these kinds of line-wrapping errors frequently.  The bugs are CAUSED by the 
line length rule.

Also, in the case of multi-line templates, there is no way to wrap them without 
getting very far from WYSIWYG:

def run_diagnostics(location, system, test_engineer):
    ...
    if (failures):
        print(dedent(f'''\
            There were {num_failures) anomalies detected in the {location} 
{system} at {event_time ::%I:%M:%S}}.
            These anomalies were classified as {level}.  Further action is {'' 
if escalate else 'not'} recommended.
        ''')
    else:
        print(dedent(f'''\
            A total of {num_test_cases} diagnostics were run in the {location} 
{system} as of {event_time::%I:%M:%S}}.
            No anomalies were detected and further action is not required.
            Test signed by {test_engineer.title()}.
    ...


Raymond
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to