[Python-ideas] PEP 8 update on line length

Anders Hovmöller boxed at killingar.net
Tue Feb 19 12:06:57 EST 2019



> On 19 Feb 2019, at 17:36, Rhodri James <rhodri at kynesim.co.uk> wrote:
> 
> On 19/02/2019 16:26, Anders Hovmöller wrote:
>>> If it were me, I'd probably write (or would have re-written when I added
>>> the type hints) that as follows:
>>> 
>>>    def resolve_annotations(
>>>            *,
>>>            raw_annotations: Dict[str, Type[Any]],
>>>            module_name: Optional[str]
>>>        ) -> Dict[str, Type[Any]]:
>> I would like to point out here that breaking up a line breaks grepping quite badly. I've had to write AST-based searches to find simple usages of arguments in the code base at work precisely because of code that is split on likes like this. (This tool is available here: https://github.com/boxed/parso_utils)
> 
> How odd.  I always break up long lines like this, and I've never once had an issue grepping.

Maybe you know some grep magic I don't? Is there a way to do multi line grep that knows that open paren means to ignore new lines until the matching close paren? I'd love to hear about it!

/ Anders 


More information about the Python-ideas mailing list