[Python-ideas] PEP 8 update on line length

Anders Hovmöller boxed at killingar.net
Tue Feb 19 11:26:37 EST 2019


> 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) 

I would vastly prefer a soft like break algorithm that formatted the code as per your examples and having the code on disk be single line no matter what. 

In proprietary projects where one can agree on the tools used for the code this can be quite doable, but I agree it's not great for open source projects. 

/ Anders 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190219/f4711e22/attachment.html>


More information about the Python-ideas mailing list