Why I want to blacken most of Leo's sources

60 views
Skip to first unread message

Edward K. Ream

unread,
Aug 29, 2019, 1:04:02 PM8/29/19
to leo-editor
This is Leo issue #1272. Don't panic: blacking your code will always be entirely optional.

A setting will specify where black breaks lines. I'll probably use the suggested default, 88, but if you do decide to use black, you can pick your own value.

Imo, it's time that Leo's sources be compatible with black.  black is good enough to be a universal standard, and I think it soon will be.

I'm already dissatisfied with using single quotes where black recommends double quotes.  It's not that there is anything inherently dubious about single quotes, but why not follow the (emerging) standard?

Your comments, please, Amigos.

Edward

Terry Brown

unread,
Aug 29, 2019, 1:28:50 PM8/29/19
to leo-e...@googlegroups.com
On Thu, 29 Aug 2019 10:04:02 -0700 (PDT)
"Edward K. Ream" <edre...@gmail.com> wrote:

> I'm already dissatisfied with using single quotes where black
> recommends double quotes.  It's not that there is anything inherently
> dubious about single quotes, but why not follow the (emerging)
> standard?

Normalizing quotes is actually the one thing I don't have black do.
But only because I have a personal habit of using single for restricted
vocabularies (dict keys, things that are defined on a list somewhere),
and double for more narrative text.

"I've preferred double for narrative text because you don't need to
fiddle with apostrophes"

but stats['spd']['mean'] just reminds me spd and mean are defined
upstream somewhere are are not just arbitrary.

I guess this is irrelevant to Leo's sources though :)

Edward K. Ream

unread,
Aug 29, 2019, 4:41:51 PM8/29/19
to leo-editor
On Thu, Aug 29, 2019 at 12:28 PM Terry Brown <terry...@gmail.com> wrote:

Normalizing quotes is actually the one thing I don't have black do.

I didn't remember that that was a black option.  In that case, it should be a Leo setting as well.

Edward

Matt Wilkie

unread,
Aug 30, 2019, 12:35:03 AM8/30/19
to leo-editor
I'm happy to have black available and used by default. I know all of my own stuff could use it. I tend to constantly switch between single and double quotes without much rhyme and reason, so normalizing would be good.

Somewhat related is isort - https://github.com/timothycrosley/isort, for standardized placement and organizing of imports. I ran into it yesterday while reading up on Black.

-matt

Edward K. Ream

unread,
Aug 30, 2019, 7:54:16 AM8/30/19
to leo-editor

On Thu, Aug 29, 2019 at 11:35 PM Matt Wilkie <map...@gmail.com> wrote:
I'm happy to have black available and used by default. I know all of my own stuff could use it. I tend to constantly switch between single and double quotes without much rhyme and reason, so normalizing would be good.

Glad you like it.  I've been dithering about quotes.  The new default is not to normalize strings.  That should prevent unpleasant surprises.

Please look at the updated #1272. It contains the full status.

In particular, I rewrote the code that allows black to handle Leo constructs such as @others and section references.  It works almost all of the time.  There is only one place in all of Leo's core that fails.

Somewhat related is isort - https://github.com/timothycrosley/isort, for standardized placement and organizing of imports. I ran into it yesterday while reading up on Black.

Thanks for the link.

Edward
Reply all
Reply to author
Forward
0 new messages