I've been looking into using a code formatter as a code base size has grown as 
well as contributing developers. I've found and played with autopep, black, and 
yapf. As well as whatever pycharm has (which may just be gui preferences around 
one of those 3).

I have 2 questions:
1) Are there any major other formatters that I can/should look at? I see some 
"online" pretty printers, but I'm after something I can run on whole recursive 
directories of code.

2) I use more and type annotations (at least at the trivial level). But I like 
to have variable annotations tightly bound to the identifier, kind of like a 
subscript. So I want to see 

  def foo_bar(baz:int) -> bool:
    yak:str = 'howdy mates'

And NOT 

  def foo_bar(baz: int) -> bool:
    yak: str = 'howdy mates'

In other cases though (dictionaries for example), I'm fine with (and prefer) 
the spacing.

Is there anyway to make any of these formatters do this?

We write a lot of Swift and Kotlin as well as which uses the same general 
syntax (identifier:Type) for type annotation, and we'd like to have some 
consistency across the styles (we pack the couplets in those two).


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to