News for hackers. Stuff that matters.
Re:Simplicity of IRC by Iv on Sunday January 09, 2022 @09:28AM (#29863500)
> on windows

This is the mistake. Linux and, I believe, OSX come with several tools pre-installed including python.

Re:Simplicity of IRC by young_unixer on Sunday January 09, 2022 @01:35PM (#29866026)
Which creates more problems than solutions.

If the Python version that comes with your OS is not the one you want (e.g. it's outdated), then you'll have to:

1. Install the version you want anyway, and all the tools required (that usually don't come preinstalled in the OS)

2. Try to not make them collide, which, last time I tried, was a PITA, because the OS depends on original version of Python being in the the $PATH or something.

Python on Ubuntu is notoriously misleading for newbies, because even if you apt install python3 and it tells you that it's already installed, it's not fully installed. For example, venv is not installed, you have to `sudo apt install python3-venv` and do that for every Python module that's not installed by default.

It would be easier if Linux didn't come with Python, and then people simply installed the actual, full version of Python they wanted.

Re:Simplicity of IRC by f1refly on Sunday January 09, 2022 @06:13PM (#29868433)
>and then people simply installed the actual, full version of Python they wanted.

Which then wouldn't work for all the repository python programs. The repo's python is what everything is built and tested against, so there is no replacing that.

Re:Simplicity of IRC by young_unixer on Sunday January 09, 2022 @07:12PM (#29868936)
The package manager could install its own version of Python, isolated from the rest of the system, so that it doesn't get in the way of the user, but repository programs know where it is and can use it.
Re:Simplicity of IRC by throwhauser on Sunday January 09, 2022 @01:01PM (#29865720)
Anytime I do anything with python on Linux or MacOS I encounter python, python3, pip, pip3, venv, virtualenv, conda, poetry... so much machinery around the code. Throw in your platform-specifc package manager of choice as well (apt, brew, etc)

EDIT: Oh and pipenv!

Re:Simplicity of IRC by emeth on Sunday January 09, 2022 @10:01AM (#29863768)
> Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. Future versions of macOS won’t include scripting language runtimes by default, and might require you to install additional packages.

https://apple.stackexchange.com/questions/406244/will-macos-...

Re:Simplicity of IRC by pmarreck on Sunday January 09, 2022 @05:02PM (#29867765)
That's probably for the best, as the ones that ship are often old and buggy, and Apple doesn't seem to care for maintaining them (even if they pretend to care about developers). As long as there's a way for actual developers to install these tools themselves (such as Homebrew), things will work out fine.
Re:Simplicity of IRC by enumjorge on Sunday January 09, 2022 @09:53AM (#29863707)
A tool shouldn’t need to come preinstalled with the OS in order to be useable. And “switch to a different OS” is not a good solution especially for cases where you don’t control the OS you run.

For a long time MacOS came with only Python 2.x installed. I looked up what the latest version of MacOS comes with and came across an Apple support forum post with several responses posting conflicting answers [0]. One person got an Xcode related error. Having to install a heavyweight IDE just to get a language to run correctly is the type of needless complication the parent comment is talking about.

[0] https://developer.apple.com/forums/thread/691403

Re:Simplicity of IRC by lloeki on Sunday January 09, 2022 @10:38AM (#29864135)
> Having to install a heavyweight IDE

xcode-select --install pulls in the CLT, which is a fairly reasonably sized download given that it includes various essential dev tools including python3 but without Xcode.

This is hinted at by attempting to run python3 before any install, which calls a stub prompting you to do just that.

py2/ruby/perl/etc... are part of the base OS for backwards compatibility/expectations (because they were so before Xcode/CLT were even a thing) but have been marked as due for removal from base for something like half a decade. My bet is that at some point they will move to the CLT (or some other optional download) as well.

Re:Simplicity of IRC by AnIdiotOnTheNet on Sunday January 09, 2022 @09:53AM (#29863704)
Windows comes with PowerShell, which is a pretty fully featured programming language that can interface directly with the .NET ecosystem.
Re:Simplicity of IRC by fivea on Sunday January 09, 2022 @10:30AM (#29864066)
> Windows comes with PowerShell (...)

It might be just me, but PowerShell feels outright developer-hostile even when compared to Bash. Perhaps it's their approach to rely primarily on .NET stuff which makes things so arcane, but when given the option it's far simpler and better to go with, say, python than PowerShell.

Re:Simplicity of IRC by AnIdiotOnTheNet on Sunday January 09, 2022 @10:43AM (#29864193)
I couldn't disagree more, I think bash is a horrifically bad programming language. Honestly I'm incredibly surprised anyone could compare PowerShell and bash and think that PowerShell is the arcane one.
Re:Simplicity of IRC by fivea on Sunday January 09, 2022 @11:43AM (#29864860)
> I couldn't disagree more, I think bash is a horrifically bad programming language.

Bash is described as a "command language" and not a programming language per se.

Bash is what you use to type in commands, and automate said commands if you need to whip out a quick script that runs what you would otherwise run manually. Bash, scripting-wise, is command line glue.

If all you want to do is run commands with some logic, PowerShell is simply dreadful and outright developer-hostile. I doubt there is a single person on earth who uses PowerShell as a command shell like Bash is used.

Re:Simplicity of IRC by carlhjerpe on Monday January 10, 2022 @07:26AM (#29873746)
> If all you want to do is run commands with some logic, PowerShell is simply dreadful and outright developer-hostile. I doubt there is a single person on earth who uses PowerShell as a command shell like Bash is used.

Expand your views. Everyone aren't you, didn't learn the same things as you and understand different things than you.

I learned some C++ as my first language, therefore I got stuck in an object oriented mindset, this translates really well to PowerShell and really poorly to bash. The thing where everything is text doesn't make sense, text isn't stable and everyone will write their own partially broken parsing implementation. In PowerShell they try to make everything an object, with type checking and other goodies, solid autocomplete for scripts being one.

In PowerShell I can deserialise JSON and perform CRUD operations on the data easily.

I'd say powershell is outright developer friendly as it brings a production grade language to the scripting table.

If powershell could parse bash completion files and integrate sudo better I'd use it as a command shell on all platforms, which right now are limited to MacOS and Linux.

Re:Simplicity of IRC by AnIdiotOnTheNet on Sunday January 09, 2022 @01:21PM (#29865893)
Again, I disagree and regularly use PowerShell as a command language --as do many Windows admins-- and much prefer its object-based pipelining and relatively sensible and consistent command and argument naming to bash's error-prone text pipeline and mixture of 2-letter abbreviations and complete nonsense names. But whatever, to each their own.

This subthread was specifically about programming languages being available out of the box in OSs, so when you brought up bash my natural assumption was that meant as a programming language.

Re:Simplicity of IRC by majkinetor on Sunday January 09, 2022 @01:01PM (#29865716)
Totally. Bash is such nonsense. Its little better then batch on Windows.

PowerShell is such joy that it should be there on any Linux as default interactive shell.

Re:Simplicity of IRC by chungy on Sunday January 09, 2022 @02:23PM (#29866473)
PowerShell is the worst of bash and perl combined. It's like Microsoft took a look at each of those, "We can do that!" and implemented them.... worse.
Re:Simplicity of IRC by mavhc on Sunday January 09, 2022 @06:37PM (#29868636)
What's bad about it specifically? Main thing I don't like is verb-noun, breaks tab complete
Re:Simplicity of IRC by williamtwild on Sunday January 09, 2022 @12:00PM (#29865067)
The problem is that you think bash is a programming language.
Re:Simplicity of IRC by cxr on Sunday January 09, 2022 @01:43PM (#29866107)
The person who you're responding to is engaging with the person who they're responding to in the terms chosen by the latter. If the original commenter hadn't written, "PowerShell feels outright developer-hostile even when compared to Bash", then we might have some reason to find fault with the person who replied. Considering that's what did happen, however, this comment of yours—which is both snarky and implicitly demands the wrong person to take responsibility for the comparison—just comes across as annoying.
Re:Simplicity of IRC by majkinetor on Sunday January 09, 2022 @01:02PM (#29865738)
Its bad even for one liners.
Re:Simplicity of IRC by mavhc on Sunday January 09, 2022 @06:37PM (#29868623)
People complained about Python using whitespace, adding an extra space in bash can break the whole thing
Re:Simplicity of IRC by dan-robertson on Sunday January 09, 2022 @04:22PM (#29867446)
I wanted to focus on a ‘first introduction to programming’ which on average means windows. Obviously installing and running python can be easier on Linux but you still have problems with anything not-just-text.