[Python-ideas] PEP 8 update on line length

Rhodri James rhodri at kynesim.co.uk
Tue Feb 19 12:12:38 EST 2019


On 19/02/2019 17:06, Anders Hovmöller wrote:
> 
> 
>> 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!

I probably don't know any more grep magic than you, I've just never had 
cause to grep for anything that long.  I am a touch bemused that you do 
frequently have cause, but each to his own, I suppose.


-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-ideas mailing list