Live data from Hacker News

I'm switching to Python and actually liking it

cesarsotovalero.net

181–190 of 718 posts

Re: I'm switching to Python and actually liking it

#181
post #5

> Python has done a good job of hiding its legacy ugliness (such as __init__, __new__, and similar aberrations), swettening its syntax to accomodate developers with good taste. What exactly is the problem with __init__ or __new__? @dataclass is very nice syntactic sugar, but are we arguing here that having access to initializer/allocator/constructor dunder methods is "legacy ugliness"? This is the core of pythonic bu…

Bizarre is that you don’t consider it ugly. Kotlin: constructor is either part of class definition or keyword constructor. Ruby: initialize JS: constructor Python: ______new______, _______init_______ Literally this meme: https://knowyourmeme.com/memes/three-headed-dragon

Some-other-language-user complaining about python ugliness:_____new_____ and _____init_____

Same-other-language-user:

((()))()()()({}{}{{(((())){}}}}{}{}{};;;;();)(;}}}

*not supposed to be correct syntax, it's just a joke

Re: I'm switching to Python and actually liking it

#182
post #173
post #163

Earlier quoted context omitted.

Yes, I'd say Python's crown as the go-to lightweight scripting and web development language was mostly ceded to JS. It's still reigning champion of data science, and of course it has a huge number of uses and users still around, but it's not really cool or in vogue outside of those circles.

Do people really turn to JS (instead of Python) for lightweight scripting? Are we talking about the "better Bash" use case?

that would be very surprising

Re: I'm switching to Python and actually liking it

#183

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

> Is this just junior devs who never learned it Seems more like it's fallen out of favor with senior devs who have moved to Go/Rust.

you'd be crazy (senior or not) not to use Go for Go stuff and Python for Python stuff

Re: I'm switching to Python and actually liking it

#184

Earlier quoted context omitted.

I resisted pipx, poetry, anaconda and probably some other things, as I didn't see the point over venv+pip. But uv is just so damn good, there's no going back.

Feel like pipx walked so uv could run, it popularized the idea of abstracting the environment management away from the user.

pipx is still the best tool for standalone utility type of packages: "yt-dlp", "glances" (like htop), etc.

Re: I'm switching to Python and actually liking it

#185
post #173
post #163

Earlier quoted context omitted.

Yes, I'd say Python's crown as the go-to lightweight scripting and web development language was mostly ceded to JS. It's still reigning champion of data science, and of course it has a huge number of uses and users still around, but it's not really cool or in vogue outside of those circles.

Do people really turn to JS (instead of Python) for lightweight scripting? Are we talking about the "better Bash" use case?

JS devs do, and there are a lot of them

Re: I'm switching to Python and actually liking it

#186

"And guess what's the de facto programming language for AI? Yep, that sneaky one." Is this referring at all to to PyTorch. If not, any guesses what the author has in mind "Not only because the syntax is more human-friendly, but also because the Python interpreter is natively integrated in all Unix distros." Is this referring to GNU/Linux. UNIX (UNIX-like) includes more than Linux; some UNIX distributions do not inclu…

"And guess what's the de facto programming language for AI? Yep, that sneaky one."

He's referring to Python in general

"Not only because the syntax is more human-friendly, but also because the Python interpreter is natively integrated in all Unix distros."

I think he means that its available or readily available in many major linux distributions like Ubuntu, Fedora, NixOS, etc. I don't think native is the right word.

I use bash too but Python is amazing. You're right, there are problems related to packaging and speed, but it is still very often the right tool for the job. It's powerful, easy to use, and open source.

Re: I'm switching to Python and actually liking it

#187
post #172

Earlier quoted context omitted.

This is nitpicking, but this is a good usecase for the := operator: if not (API_KEY := os.getenv("API_KEY")): ... For internal tools I just let os.environ["API_KEY"] raise a KeyError. It's descriptive enough.

I write a decent amount of Python, but find the walrus operator unintuitive. It's a little funky that API_KEY is available outside of the `if`, perhaps because I had first seen the walrus operator in golang, which restricts the scope to the block.

This isn't really unique to the walrus operator, it's just a general python quirk (albeit one I find incredibly annoying). `for i in range(5): ...` will leave `i` bound to 4 after the loop.

Re: I'm switching to Python and actually liking it

#188
post #141

> Not only because the syntax is more human-friendly, but also because the Python interpreter is natively integrated in all Unix distros That's kind of very optimistic evaluation - literally anything beyond "import json" will likely lead you into the abyss of virtual envs. Running something created with say Python 3.13.x on Ubuntu 22.04 or even 24.04 (LTSs) / Rocky 9 and the whole can of worms opened. things like vir…

I have a silly theory that I only half joke about that docker/containers wouldn't've ever taken off as fast as it did if it didn't solve the horrible python dependency hell so well. You know something is bad when fancy chrooting is the only ergonomic way of shipping something that works. My first taste of Python was as a sysadmin, back in 2012 or so, installing a service written in Python on a server. The dependency…

> I have a silly theory that I only half joke about that docker/containers wouldn't've ever taken off as fast as it did if it didn't solve the horrible python dependency hell so well.

I don't think this is a silly theory at all. The only possibly silly part is that containers specifically helped solve this problem just for python. Lots of other software systems built with other languages have "dependency hell."

Re: I'm switching to Python and actually liking it

#189

When did Python go out of fashion? This is the second article I've seen talking about it as if it's some kind abomination. I get that it's not the shiny new thing, but I don't understand people hating on it. Is this just junior devs who never learned it, or is there some new language out that I missed? (And please don't tell me Javascript....)

I have had a somewhat unearned distaste for Python for the last decade or so.

I mostly just don’t like some of the design decisions it made. I don’t like that lambdas can’t span multiple lines, I don’t like how slow loops are, I don’t like some functions seem to mutate lists and others don’t, and I am sure that there are other things I missed.

But it really comes down to the fact that my career hasn’t used it much. I occasionally have had to jump into it because of scripting stuff, and I even did teach it for a programming 101 course at a university, but I haven’t had a lot of exposure otherwise.

For scripting stuff for myself, I usually end up using Clojure with GraalVM (yes I know about babashka), or nowadays even just a static linked compiled language like Rust.

I don’t really understand why people think that compiled languages can’t be used for scripting (or at least task automation), honestly. Yes you have to add a compilation step. This involves maybe one extra step during development, but realistically not even that. With Rust I just do cargo run while developing, I don’t see how that’s harder than typing Python.

Post reply on HN