Łukasz Langa - Life Is Better Painted Black, or: How to Stop Worrying and Embrace Auto-Formatting

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии • 34

  • @sep69
    @sep69 5 лет назад +7

    Came across this video and tried out black. Awesome tool ! Readability of my scribbles improved a lot. Just enabled it in Pycharm.

  • @JonathanMGithumbi
    @JonathanMGithumbi Год назад

    Just now discovering black, can definitely say it changed the way i approach at code formatting

  • @marco_gorelli
    @marco_gorelli 4 года назад +4

    Great talk, I love using `black` - thanks!

    • @ewerybody
      @ewerybody 4 года назад +1

      you mean "black"? 😉

    • @armynyus9123
      @armynyus9123 4 года назад

      @@ewerybody Interpreter says: 'black' when I print it

  • @PanduPoluan
    @PanduPoluan 4 года назад +4

    `black` + judicious (sparing!) use of "# fmt: off" == BLISS
    Thank you for this great tool, Lukas. I _do_ disagree with a few 'opinions' of Black, but then I took a step back, saw that those were basically bikeshedding, shrugs, and accept.
    How I wish the current FOSS project I'm now involved in adopted black...

  • @WebLego
    @WebLego 4 года назад +6

    Love using black, thank you so much for it, great job! The only thing that is weird to me is if one has a short line, and an inline comment on the same line, its like to add brackets around the statement and position the comment in a way that doesnt look related anymore. Maybe fixed by now.

  • @TotalImmort7l
    @TotalImmort7l 3 года назад +4

    *isort -m 3* and *black -l 79 -t py38* must be the only way.

  • @leaht-pu1tm
    @leaht-pu1tm Год назад

    Using it from the terminal to format my files is great. Integration in visual studio code just does not work.

  • @liuyangwan1535
    @liuyangwan1535 5 лет назад +8

    The github link is 404

    • @ElenaWilliams-elequ
      @ElenaWilliams-elequ 4 года назад

      github.com/psf/black

    • @liuyangwan1535
      @liuyangwan1535 4 года назад +1

      @@ElenaWilliams-elequ I mean the slides link

    • @plato4ek
      @plato4ek 4 года назад

      Yeah, you're right, looks like they had deleted this repository. There is also no slides of this talk at speakerdeck.com link.

  • @armynyus9123
    @armynyus9123 5 лет назад +8

    So the only thing we miss in python is to agree all on black's default style. Except... that I'll never ever accept double apostrophes - so I patched my black . Ups... :-)

    • @WebLego
      @WebLego 4 года назад

      Just use -s

    • @armynyus9123
      @armynyus9123 4 года назад +2

      @@WebLego then what's the point of it. We want the same code style project wide and i'm not the only one working on the code base. We'll go with a patched version, there are some options meanwhile, oitnb or axblack. Their ignorance regarding single quotes but leaving line length configurable is a joke.

  • @মন্দির-ধ৭ণ
    @মন্দির-ধ৭ণ 8 месяцев назад

    watching in 2024 of learnign python

  • @MrTigerstyle80
    @MrTigerstyle80 4 года назад +3

    I recently started working on a code base that used black. It is highly annoying. I don’t get why everyone is so head over heels on it.

  • @StefanoBorini
    @StefanoBorini 5 лет назад +2

    20:30 no. that's a pep8 violation and it looks awful. You can't visually distinguish the arguments from the body, and it's absolutely the wrong formatting to do. It becomes even worse when you have a return value type specification.

    • @Dave__AC
      @Dave__AC 5 лет назад

      You can visually distinguish the arguments from the body by the dedented ):. The goal of the project is to minimize diffs so the ): has to be on its own line, the decision is just about indentation and their way is the clearest imo. Also it is pep8 compliant to do it this way. "The closing brace/bracket/parenthesis on multiline constructs... may be lined up under the first character of the line that starts the multiline construct" - www.python.org/dev/peps/pep-0008/?#indentation

    • @StefanoBorini
      @StefanoBorini 4 года назад

      @@Dave__AC It is literally defined as wrong in the second verbatim text in that section. Literally. What you are referring to has to do with variables, not function definitions.

    • @aicryptobro
      @aicryptobro 3 года назад +1

      I checked the first two verbatims in pep8, and neither mentions the sad face on the next line.

    • @smort123
      @smort123 2 года назад +4

      @@StefanoBorini Its almost as if he told why we write function definitions exactly like we write lists or other data structures.

  • @maxekstrom6153
    @maxekstrom6153 5 лет назад +8

    You lost me at double-quoted strings :)

    • @DanHaiduc
      @DanHaiduc 5 лет назад +3

      I actually prefer double-quotes, because English sometimes uses single quotes. But I am always too lazy to use double-quotes, because of having to hold Shift in addition to pressing the quote button. Black fixes this!

    • @BennyDaon
      @BennyDaon 5 лет назад +2

      You can use ‘-S’ to not change the quotes

    • @armynyus9123
      @armynyus9123 4 года назад +1

      @@BennyDaon Which is bull.

    • @hi_arav
      @hi_arav 3 года назад +1

      Just use `black -S|--skip-string-normalization` and keep the rest. :)

  • @icarus6430
    @icarus6430 4 года назад +2

    you lazy programmers! just spent a little more time and patience! or don't code at all.

    • @smort123
      @smort123 2 года назад +1

      Jesse what the fuck are you talking about.

    • @biskitpagla
      @biskitpagla 2 года назад +9

      sure thing grandpa, time for your meds now