Live data from Hacker News

Breaking up with Python

cedwards.xyz

81–90 of 179 posts

Re: Breaking up with Python

#81

Pretty amazing success for the Python standard library to be labeled as barebones.

Was very surprised to see that in the article! My complaint is the Python std lib is bloated. If I could design a Python 4, it would be a subset of Python. Ie get rid of the various struct-like data structures (eg both types of named tuple) other than dataclass that have accumulated over time.

There is an accepted PEP[0] which removed a bunch of modules from the standard library in 3.11

[0] https://peps.python.org/pep-0594/ that

Re: Breaking up with Python

#82
post #4

I have just started getting into python as I'm experimenting with pytorch and after a lot of googling I'm still trying to figure out how to use conda properly. Could anyone point me to the best way to manage python environments and packages?

Not conda, but using the built-ins should work for most use cases.

---

1. Create a virtual environment named venv

  cd $PROJECT_FOLDER
  python -m venv venv
2. Activate it.

  source ./venv/bin/activate
(In vscode, Ctrl+P > Select: Python Interpreter)

3. Define and install dependencies

  nano requirements.txt
  pip install -r requirements.txt
(or just "pip install ___")

Re: Breaking up with Python

#83
post #18

> Python’s documentation sucks I can't agree with this. I have always had a very good experience with python documentation. One can use the built-in "help" function which works seamlessly with the docstring feature of the language. The complaint in the blog post seems to refer to the UI of the website missing a table of contents for functions. Yeah sure they could add that but I don't see it as a big point. > Python’…

I have to agree. I have a lot of gripes with Python, but the documentation and the standard library are generally great.

The author favors Javascript while deriding Python for its syntax, type-hints, and standard library, and favors Go while deriding a Python Docker image's size and documentation. I feel like the author must use Python in a very different way than I do for Javascript and Go to be the winners in these categories.

I do agree without reservation that package management and dependencies are horrible with Python.

Re: Breaking up with Python

#84
post #4

I have just started getting into python as I'm experimenting with pytorch and after a lot of googling I'm still trying to figure out how to use conda properly. Could anyone point me to the best way to manage python environments and packages?

If you are using conda, use its environment management:

https://docs.conda.io/projects/conda/en/latest/user-guide/ta...

(Lots of the other advice here—mamba excepted, and that might be a good choice—is good for python in general but potentially will cause problems if you are otherwise using anaconda.)

Re: Breaking up with Python

#85
This was awfully generic. Not necessarily wrong, but certainly not a meaningful blow against python that's going to show anyone the light and give them tangible thoughts about using another tool. (Especially given the breath of what python is used for. Does it suck at everything?) What are we supposed to get out of this?

Re: Breaking up with Python

#86

I've been recommending Python to the occasional aspirational young programmer. Is it already passé? What would you recommend instead for a starter language? Looking for beginner-friendliness, widespread use, and longevity. edit: to be clear, I hope this won't devolve into a language flamewar. I'm sincerely interested in other devs' opinions, and hoping that either Python is still a good recommendation (which seems to…

I have, for the life of me, never understood the 'beginner friendly' argument for python. Java, PHP or JavaScript for 'widespread use and longevity'. None of these are going anywhere, and I think you'd find more resources for beginners to advanced users for those 3. Yes, of course there's others - everyone has their faves. And Python will continue to kick around as well, but I've just never understood the 'beginner f…

Java the language used to be so simple that it needed significant library usage to accomplish anything at all. It aimed for ‘safe C with classes’ and succeeded… in the enterprise where management was making technical decisions. After feeling the heat from C# it managed to catch up, mostly, to modern realities. Not a good beginner language, despite the simplicity.

PHP was not designed at all. It took a decade to make it more than a template processor. The biggest, by far, selling point was ease of deployment: ftp and done. Good if you want to display something in a browser. Learning programming, not so much.

Javascript is starting to become a sane language with ES6. It’s an accident of history that became an industry standard due to sheer power of will of browser companies. Tooling complexity in its ecosystem rivals, if not exceeds, that of C++. Recommending js s as a language to learn programming on has been until last couple of years irresponsible.

Python was designed to be beginner friendly, it was the next iteration of other beginner-friendly languages that had some academic research done about, you guessed it, beginner friendliness. It is not an accident it’s recommended for newbies! Due to that and a decade of 1) numpy for biological computing 2) django/flask for web services it’s ubiquitous in two very loosely connected domains, giving birth to jupyter and tensor libraries, and here we are. Turns out a batteries-included standard library makes packaging not a priority for too long.

Re: Breaking up with Python

#87
Doesn't JavaScript suffer from most of the same issues the author raises about Python.

> Documentation

JavaScript wins here thanks to MDN, but it's not the official documentation.

> Package Management

I agree that Python's package management has its issues, but JS is insane in this regard

> Standard Library

JavaScript's standard library is definitely smaller than Python's

> Slow

This is clearly a win for JS

> Size

When comparing the slim official Python docker image with the equivalent NodeJS image, Python wins in size

> Syntax

This is the most subjective point. I prefer Python's syntax because it's less noisy, but JavaScript's syntax is more consistent.

Regarding type annotations they don't do anything at runtime, but they are extremely useful for IDEs.

Re: Breaking up with Python

#88
post #18

> Python’s documentation sucks I can't agree with this. I have always had a very good experience with python documentation. One can use the built-in "help" function which works seamlessly with the docstring feature of the language. The complaint in the blog post seems to refer to the UI of the website missing a table of contents for functions. Yeah sure they could add that but I don't see it as a big point. > Python’…

>> Python is huge, the python:3.9-slim Docker image is 118MB

> Hmmm. 118MB isn't really that big anymore. The docker image would presumably be cached and reused in a deployment pipeline.

Caching aside, it seems that the Python slim image is built on Debian, which will usually have slightly bigger container sizes than something like Alpine, which is comparatively more lightweight/barebones:

  > docker pull python:3.9-slim && docker image ls
  REPOSITORY   TAG        IMAGE ID       CREATED        SIZE
  python       3.9-slim   e2f464551004   8 days ago     125MB

  > docker run --rm python:3.9-slim sh -c "cat /etc/*-release"
  PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
  NAME="Debian GNU/Linux"
  
  > docker pull python:3.9-alpine3.17 && docker image ls
  REPOSITORY   TAG              IMAGE ID       CREATED        SIZE
  python       3.9-slim         e2f464551004   8 days ago     125MB
  python       3.9-alpine3.17   d6d1ed462b20   3 weeks ago    48.8MB
  
  > docker run --rm python:3.9-alpine3.17 sh -c "cat /etc/*-release"
  3.17.0
  NAME="Alpine Linux"
Now, I'm not saying that Alpine is the perfect base distro for your container images, despite it generally being a reasonable pick (I've heard some stories about Python performance in particular, and sometimes there are package related oddities), but the distro that you choose will most definitely have an effect on what you'll ship.

Of course, caching and any additional tools that you may or may not want to include also plays a part. Personally, I just went for maximum predictability and usability, and now build most of my personal container images basing them on Ubuntu LTS, with some common CLI tools included for debugging: https://blog.kronis.dev/articles/using-ubuntu-as-the-base-fo...

Just use whatever works for you, but rest assured that JDK and other stacks will typically also have some overhead to them. Python might not be the worst offender here. Something like Go with compiled binaries is still very nice, granted.

Re: Breaking up with Python

#89

I've been recommending Python to the occasional aspirational young programmer. Is it already passé? What would you recommend instead for a starter language? Looking for beginner-friendliness, widespread use, and longevity. edit: to be clear, I hope this won't devolve into a language flamewar. I'm sincerely interested in other devs' opinions, and hoping that either Python is still a good recommendation (which seems to…

I hate a lot of things about python because I've been using it for almost 20 years, and I know its innards, its history and its trajectory. I want to love Nim or Julia or Typescript, but they just aren't doing it for me. But you can't hate a language as deeply as I do without loving it as long as I have. I don't think this article, or my own opinions, are representative of the community.

Re: Breaking up with Python

#90
I do not understand the incentive structure that would lead anyone to believe such a low effort blog post brings anything to anyone. The points raised are very standard, have reasons and counterpoints, and finally just invoking Go and JS without any details is so meh...
Post reply on HN