4 ms·
Another way in which Python is the new BASIC is that it's preinstalled on the vast majority of Linux systems that have a terminal. Once it passed that threshold
by baobun 2y ago
Another way in which Python is the new BASIC is that it's preinstalled on the vast majority of Linux systems that have a terminal. Once it passed that threshold its popularity for utilities and scripts is a self-fulfilling prophecy.
It's common that I'd prefer Ruby but pick Python because it can be expected to run out of the box pretty much anywhere as long as you're conservative with syntax and dependencies (and have automated compat tests).
Its only real interpreted competitors there are Bash, POSIX shell, and Perl, I think.
- hulitu 2y ago> Another way in which Python is the new BASIC is that it's preinstalled on the vast majority of Linux systems that have a terminal Pyrhon 2 or Python 3 ? /s
- zahlman 2y agoUnfortunately, while this is a fine way to start experimenting with Python, the Linux system installation of Python is really not suitable for development in general, aside from developing software meant for your local use as part of the system. In particular, if you're based on Debian, the system Python likely lacks several pieces by default that the Python team considers standard: `venv` (https://software.codidact.com/posts/291789 https://software.codidact.com/posts/291789) and `tkinter` (https://software.codidact.com/posts/291791 https://software.codidact.com/posts/291791) standard libraries, and Pip (not part of the standard library, but has privileged status - https://software.codidact.com/posts/291787 https://software.codidact.com/posts/291787). You'll also run into problems (especially with Python 3.11 onward - https://software.codidact.com/posts/291839 https://software.codidact.com/posts/291839) trying to install third-party libraries without making a separate environment first (which you should do anyway).
- baobun 2y agoThe point is to be conservative enough that you stick to packages in distro repos, so that you don't need to pull in externally managed code. But if you insist or the use-case demands, at least python3-venv is an apt/yum/apk/pacman away so you shouldnt need to --break-system-packages or manually install in any case?
- zahlman 2y ago>The point is to be conservative enough that you stick to packages in distro repos, so that you don't need to pull in externally managed code. Yes, that's the idea. And it's fine for power users, not so much for developers. And yes, of course developers have easy access to doing things the right way for developers. But a lot of people who are just starting out as developers seem to really resent the fact that they might have to actually learn something at this step. It gets even worse once they're asked to make a choice of tooling, and to have the knowledge necessary to make an informed choice based on their needs and preferences. I don't have a lot of sympathy for that attitude, as I covered on my blog (https://zahlman.github.io/posts/2024/12/24/python-packaging-1/ https://zahlman.github.io/posts/2024/12/24/python-packaging-...).
- baobun 2y ago> And it's fine for power users, not so much for developers. What's behind this distinction? I would say the opposite, if anything... "Power user" to me indicates you are only messing around with your own machines. Pull down the world if you want! "Developer" to me implies writing software intended for others. Stakes and expectations are higher. You need to vet the code you pull in, consider supply-chain security, resource-usage, etc... For beginners, sure, I get you, but it sounds strange to dismiss the idea you would otgerwise agree with just because you don't think it's attractive to many casual coders, beginners, or non-programmers? Sounds like a weird sort of defeatism if you let it impact your own code.
- zahlman 2y ago>What's behind this distinction? As a "power user", I don't write code at all, beyond simple automation scripts for personal use. If I'm automating things for personal use on my own computer, then I may want to use libraries that the system provided for me because they're useful in that environment. In my case, on a Linux Mint machine, the system Python provides GNOME-specific libraries (gi.repository) that I can use to interact with other installed GUI programs. I could theoretically get those packages from PyPI (https://pypi.org/project/PyGObject/ https://pypi.org/project/PyGObject/), but they don't even bother mentioning that in their own documentation (https://pygobject.gnome.org/getting_started.html https://pygobject.gnome.org/getting_started.html) unless I look at the instructions for doing development on the project. If I did try that, I'd have to build from source which requires setting up a heavyweight build system and then making sure that Pip uses that environment to build the sdist. They won't give me a pre-built install-anywhere version, but they'll happily just install it ahead of time in my system. I trust the distro to maintain specific packages that work on my system; if I install something optional, they haven't just checked dependencies (and basically pre-solved for versions that will work no matter what subset of optional packages I want), but applied their own patches. On the other hand, they've deliberately omitted things that they feel are a risk for compromising their own package management system. (They've also omitted Tkinter, but I think that's because they want to steer you towards making your GUI in GTK instead.) As a "developer", I write software that isn't intended for just my own environment and my own distro. No, this doesn't involve any of that security stuff. If it did, there would be orders of magnitude fewer packages on PyPI, and the Node ecosystem wouldn't exist. "Software intended for others" is frequently bloated, inefficient and everything else. The "developers" you describe don't exist in my world. > but it sounds strange to dismiss the idea you would otgerwise agree with just because you don't think it's attractive to many casual coders, beginners, or non-programmers? Sounds like a weird sort of defeatism if you let it impact your own code. The point is not just that the system environment is missing pieces by default, but that you are supposed to use the system package manager to update it, which does not make everything available. `apt search tensorflow` only shows me a virtual package that seems to be for typing information. `apt-cache pkgnames | wc -l` reports to me about 1/8 as many packages as PyPI has, and that's counting packages for every programming language.
- hiAndrewQuinn 2y agoPeople really underestimate just how important this property can be for a scripting language. It's happened multiple times in my career that, due to regulatory burdens, we aren't allowed to install anything new on a given machine without going through due process - in those situations, you gotta be able to work with what you got. Unsurprisingly, Python is the language I have the most experience with by far, followed by Bash and PowerShell if you count those. All because they're actually accessible from the getgo on the system.