Hacker News new | past | comments | ask | show | jobs | submit | more hivacruz's comments login


This is a great tool. I wish there was some settings to use single quotes instead of double quotes.


Funny that this is a common reaction against opinionated tools: "I wish there was a configurable option to apply my opinions"

But the whole idea is that you should learn to suppress your ego and let the tool be the one dictating stylistic choices...

Like the sibling comment mentions:

Dusty Phillips, writer:

"Black is opinionated so you don’t have to be."


That made me wonder, so I went and tested edge cases, like "abc\"d\"ef", which black quite properly converts to 'abc"d"ef'. So it does use single quotes where appropriate.


I understand that. And this is what I like in Black. But the single quotes thing is really up to debate. When you use it with other tools such as flake8 or pylint, you have to disable a bunch of things to make them work together because no one agrees on this point.


I'm not a full time Python dev so I won't (can't) get into what choice has more merits. But there is this:

https://black.readthedocs.io/en/latest/the_black_code_style/...

Seen from outside, I think the double quotes are just the natural form of strings in lots of other places, at least in those that come from the same family than C (C++, Java, C#, Rust, just to name a few)

Also Prettier.js (which I'd call the "Black of JavaScript") also settled on double quotes. So we're left with a de facto consensus across programming languages as a whole, which kind of feels nice.


> When you use it with other tools such as flake8 or pylint, you have to disable a bunch of things to make them work together

Using Flake8 with Black requires only two configuration options [1], while Pylint requires three [2]. If you prefer to use Black with --line-length 79, then it's down to a single configuration option for Flake8 or two for Pylint.

[1]: https://black.readthedocs.io/en/latest/guides/using_black_wi...

[2]: https://black.readthedocs.io/en/latest/guides/using_black_wi...


You can have some basic configurable stuffs in an opinionated tool though, see Prettier. It allows tab/space, quote style, line length etc., to be modified.


Prettier has some options, but they are not happy about it, it's just how things happened and now cannot be "solved", i.e. remove them, albeit they would love being able to do that:

https://prettier.io/docs/en/option-philosophy.html


"My opinion is the correct one"

- Author of some tool


“No opinion is correct, so we should stop wasting time debating it.”

- advocates of code formatters


"let's everyone stop debating it the exact moment after you adopt my preferences"


There is: -S, --skip-string-normalization Don't normalize string quotes or prefixes.


IIRC, the -S only avoid single quotes to get switched to double quotes. What I meant was allowing Black to switch double-quotes to single quotes automatically.


Try nero from PyPI instead, I’ll update it to this stable release shortly.


There’s also “blue” which I’m the author of and looks similar: https://pypi.org/project/blue/ would love to get your help and thoughts in the issue tracker or by email.


What did you have in mind?


There probably is, if you use another formatter that isn’t Black.


I like yapf.


Great software. I have been using it for a few years now (and even made a few themes for it). The WYSIWYG mode is really the best feature for me and what made me picked this editor. I don't like the "Live Preview" mode on most of the editors because it opens a new window or make the main window really large.

Something I like too (not sure if it exists somewhere else) is the ability to copy/paste an article (let's say from medium) directly in the WYSIWYG mode. You basically get your article just like it is being displayed on medium: h1 detected, paragraphs, bold etc. OOTB. Really nice.


I thought HTTP 2 fixed the problem of multiple downloads of small files/dependencies?

The creator of Rails talks about it here: https://world.hey.com/dhh/modern-web-apps-without-javascript...


Khan Academy did a great writeup on their experience (including thoughts about HTTP/2) with various strategies for serving JS, such as:

- Single bundle

- No bundles (all separate files)

- Hybrid

https://blog.khanacademy.org/forgo-js-packaging-not-so-fast/


You can use the Network tab of your preferred browser to see the waterfall. HTTP2 did improve a lot, but it can’t magically resolve N-deep transitive imports without additional information. It was originally designed to have that information provided at the server level, but HTTP Push has been dead for a while. There are physical limitations at work, optimizing requests on the wire is still important.


I used this library to get familiar with Go. It is indeed very powerful and really easy to create a scraper.

My main concerns though were about testing. What if you want to create tests to check if your scraper still gets the data we want? Colly allows nested scraping and it's easy to implement but you have all your logic into one big function, making it harder to test.

Did you find a solution to this? I'm considering switching to net/http + GoQuery only to have more freedom.


Not yet but my plan was to just have a static HTML site which the tests could run against.


I like writing bugs. You learn a new thing every time you fix one of them.


I thought I have started too many workflows in a short time and got temporarily restricted!

By the way, just discovered a nice library to test GitHub Actions locally: https://github.com/nektos/act


Nice find there with Act! I've always hated the dev/test flow with GHA.


I can't work now. I'm definitely an impostor!


Use teddit.net, it works great


That's like telling a person who just quit cigarettes that vaping is a great alternative. Not using is better.


Wow. I can't believe I've never run across this. Thank you. I gotta figure out how to rewrite addresses to this on Firefox mobile when clicking a link from Google searches.

It's shocking how much better it is. You forget just how many dark patterns have crept in over time.


I feel you. Sometimes I browse projects on GitHub and I'm astonished by what people can do and I can't. Example, OpenCore[0], a famous bootloader in the Hackintosh scene. How can people even start to code this.. Awewome work, awesome people.

[0]: https://github.com/acidanthera/OpenCorePkg


Preface: I can't do this (specifically). But I have done many types of software development across two decades. My journey began with LAMP-style web work, took me to C++ and the desktop (apps, GUI toolkits, browser engines), then to embedded - from smart TVs to smart speakers, to network protocols for drone systems and beefy car infotainment ECUs and lower-level microcontroller/borderline electronics work.

My conclusion: You can get into just about anything, and for the most part the difficulty level is fairly uniform. But there's simply a vast sea of domain-specific spec knowledge out there. It doesn't mean that it's too hard for you or you can't learn it. Anything that is done at scale will fundamentally be approachable by most developers. Just be prepared you'll need to put in the time to acquire a familiarity with the local standards/specs and ways of doing things. Knowledge turns seemingly hard things into easy things, and if it's been done before chances are it's documented somewhere.

The truly hard stuff is innovating/doing things that haven't been done before. Novel development happens rarely.


Yeah, this is my conclusion too. I moved from the Oracle platform to embedded, scientific stuff like reading out custom electronics for IR cameras. And now I'm into iOS apps. It's more a question of what part of the stack feels interesting and doable to you, at a certain period in your professional life.


>acquire a familiarity with the local standards/specs

And with the bugs. Especially with bootloaders because you're in a preboot environment.


I ve done a bittorrent client, a 3D rendering engine on the PS3 and a printer driver for fun and while clearly not at the levels of a bootloader, I can have a few cookie points in interview for originality.

What I learned starting these daunting task (especially the ps3 which was closed specs), is that it s still done by humans and following familiar patterns. Most of the time you bang your head against unclear doc or go through successive layers of abstraction (to do a ps3 rendering engine, better know your basic openGL on PC, which is only possible if you know matrix and vector geometry) but EVERYTHING is possible to reach at a workable level (expert level I feel comes with money incentive, team mates and repetition). I spent 2 years on japanese, 3 hours a day, and could integrate the meaning of Haikus at the end.

I think the only true talent you must have is insane stubborness. To go through, a doc at a time. Usually after the first insane challenge (for me: learning english at a near native level, reading literature or discussing politics) of your life, you understand it s all pretty much time investment.


Did you use PSLIght SDK to develop the rendering engine on the PS3?


It can be daunting to look at a popular project in it's current state. Thankfully with Open Source Projects you can go back in time and see how the code evolved.

Here's [1] the first few commits to OpenCore. Much more approachable and inspiring.

[1] https://github.com/acidanthera/OpenCorePkg/commits/master?af...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: