Live data from Hacker News

I'm switching to Python and actually liking it

cesarsotovalero.net

631–640 of 718 posts

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

#631
post #287

> I would like to have a tool that generates the project structure for me, but I haven’t found one that fits me yet. I recommend cookiecutter for this. I have a few templates I've built with that which I use frequently: python-lib: https://github.com/simonw/python-lib click-app: https://github.com/simonw/click-app datasette-plugin: https://github.com/simonw/datasette-plugin llm-plugin: https://github.com/simonw/llm-p…

I looked at the click-app repo. If you were creating that today, would you switch from uv to pip? And to run cookiecutter do you still use pipx, or have you switched to `uv tool install`

I'm getting close to switching to uv for my templates.

I use "uvx cookiecutter" myself three days.

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

#632
post #552
post #138

Earlier quoted context omitted.

If you don't need to link C lib, you can build any combination of arch and OS for a golang program. The default tooling allows you to do so easily. If you need to link a C lib, there are ways to set it up to compile other OS (and maybe other archs).

take numpy as an example, it's gfortran mixed with C. How does cgo handle that? And there's ffmpeg....

If you got object files you can compile whatever if you have the compiler toolset. I have made a go program that links ffmpeg and is built from linux to Windows and Macos. It was not super easy but it's doable.

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

#633
post #630

Earlier quoted context omitted.

> [Software that was officially EOL and no longer supported by the developer as of January 1, 2020 — even though they went back on that with an emergency patch in April] was removed in [an OS released on October 25, 2021], which was incredibly stupid and disruptive as it caught everyone by surprise [despite the fact that the intent to EOL that software was declared many years ahead of time, and that sunset date alrea…

> I will never understand this. Perhaps because your interpretation of my comment is wrong. > was removed in [an OS released on October 25, 2021] No, no it was not! That would have been fine . Heck, it would even have been fine if they had removed it the year before. Two years. Three. I don’t care. The problem is that it was removed on a point release (not October) without warning, after setting the precedent of remo…

> The problem is that it was removed on a point release (not October) without warning, after setting the precedent of removing another language on a major release.

My perspective is that the problem is that people were trying to use Python 2 after January 1, 2020. I left it behind years before that.

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

#634
post #151
post #47

Earlier quoted context omitted.

For the last 20 years that has been the mantra. Some X "solves" all the problems. Except it doesn't. It just creates another X that is popular for a while, and doesn't somehow retroactively "fix" all the chaotic projects that are a nightmare to install and upgrade. Yes, I understand people like Python. Yes, I understand the LLM bros love it. But in a real production environment, for real applications, you still want…

I think that's true until it isn't, and people are really rallying around uv. Here's to hoping it manages to actually solve the Python packagig issue (and lots of people are saying it already has for their use cases)!

Solving it at least involves the Python maintainers making a choice, integrating it into the Python binary and sticking to it. At least. But that requires possibly annoying some people until a) whatever solution becomes mature and b) people get over it.

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

#635
post #47

Earlier quoted context omitted.

For the last 20 years that has been the mantra. Some X "solves" all the problems. Except it doesn't. It just creates another X that is popular for a while, and doesn't somehow retroactively "fix" all the chaotic projects that are a nightmare to install and upgrade. Yes, I understand people like Python. Yes, I understand the LLM bros love it. But in a real production environment, for real applications, you still want…

Some of the biggest codebases in the world are in Python, this is a bizarre statement that reeks of the hn superiority complex.

Every single language enthusiast says that some of the biggest codebases in the world are whatever their favorite major language is. And here's the thing: it is completely irrelevant whether the codebase is small or large. What counts is what it is like to use and maintain programs.

Python isn't the only language that has poor tooling. C/C++ is even bigger than Python in terms of established code base, and its tooling is nothing short of atrocious.

What helps is people realizing where tooling and production readiness should be. They can learn a lot from Rust and Go.

The it's big so therefore it must be right argument is nonsense. Worse yet: it is nonsense that excuses lack of real improvement.

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

#636
post #36

Earlier quoted context omitted.

macOS dropped PHP recently too—doing a wonderful job of losing all that developer share that Apple was slowly building up.

I much prefer installing it myself, with the required version for my project and at a known and common location.

That's fair enough. It may be less of an issue for experienced developers, but for those looking to learn the craft, it's one more barrier.

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

#637
post #80

Just a small note on the code in the linked script: API_KEY = os.environ.get("YOUTUBE_API_KEY") CHANNEL_ID = os.environ.get("YOUTUBE_CHANNEL_ID") if not API_KEY or not CHANNEL_ID: print("Missing YOUTUBE_API_KEY or YOUTUBE_CHANNEL_ID.") exit(1) Presenting the user with "Missing X OR Y" when there's no reason that OR has to be there massively frustrates the user for the near zero benefit of having one fewer if statemen…

Neophytes take notice. Attention to details like this is what separates truly great programmers from merely good ones. That said, for scripts reusable by others you should use command line arguments . Environment variables in lieu of command line arguments is a huge code smell.

Typer has a great feature that lets you optionally accept argument and flag values from environment variables by providing the environment variable name:

https://typer.tiangolo.com/tutorial/arguments/envvar/

It's especially nice for secrets. Best of both worlds :)

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

#638

Earlier quoted context omitted.

With python you can just go: 'print "hello, world!"' and that's a full-ass program You run it by saying `python hello.py`. Compare that to the amount of crap you need(ed) with 2005 Java just to have something running. The shittiness of ActivePython and generally getting python to run on Windows were a bit of a hurdle, but still it was easier than the competition

Sure, but you could've done the same thing with perl in the 80's and 90's.

You could also accidentally summon an Ancient One while trying to write a regex :D

Perl is a fine language, but it's like using a wood chipper with no safeties. It takes extreme care and know-how to use it without splattering ASCII everywhere and making an unmaintainable write-only mess.

For every beautiful and maintainable perl program (mostly irssi scripts) I've seen 99 abominations that are quicker to rewrite completely than decode wtf they are doing.

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

#639

Earlier quoted context omitted.

uv is soooo much faster than Poetry, especially for dependency resolution.

I would like to try uv, but I don't find Poetry that bad for dependency resolution times. If I have to wait 2 minutes once a week it's not the end of the world. Maybe if you're constantly installing new things that are tough to resolve it's an issue.

It's not the end of the world, but it's annoying. I used to work at a place that had a huge monorepo with tons of dependencies. Poetry would sit there grinding away for 4 or 5 minutes. With smaller projects, I agree it's not much of an issue. But, uv has other cool features and it's super snappy!

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

#640

Earlier quoted context omitted.

Sure, but you could've done the same thing with perl in the 80's and 90's.

You could also accidentally summon an Ancient One while trying to write a regex :D Perl is a fine language, but it's like using a wood chipper with no safeties. It takes extreme care and know-how to use it without splattering ASCII everywhere and making an unmaintainable write-only mess. For every beautiful and maintainable perl program (mostly irssi scripts) I've seen 99 abominations that are quicker to rewrite comp…

True, true. I remember writing full blown applications as perl CGI scripts, back in the day. I should see if I can dig up some of that stuff.
Post reply on HN