News for hackers. Stuff that matters.
Re:Escaping from Anaconda's Stranglehold on macOS by freeopinion on Sunday September 01, 2024 @07:02PM (#41421109)
After that I wonder why people think Python is a good choice to teach as a first experience in programming. Virtual environments is actually my biggest gripe with Python.

I think it is interesting to consider why Python is so popular despite such fiascos. The answers can be very informative but can also be giant red flags.

Re:Escaping from Anaconda's Stranglehold on macOS by Al-Khwarizmi on Sunday September 01, 2024 @07:22PM (#41421194)
Because every option sucks for teaching.

C/C++? Full of footguns. Java/C#? Too complicated for beginners. Pascal? Outdated. Etc.

I personally prefer C to teach first-year CS students but just as the lesser evil. A good first programming language is sorely lacking.

(Note that I'm talking about the imperative programming paradigm. The debate on whether one should start with functional programming is outside the scope of this comment).

Re:Escaping from Anaconda's Stranglehold on macOS by Spivak on Sunday September 01, 2024 @08:24PM (#41421462)
It's weird you throw out Java because they are the teaching language. They're the stick everything else is measured against. CS101 is a sea of Eclipse. Having a programming environment where all the major structures are discoverable through menus is actually pretty useful.
Re:Escaping from Anaconda's Stranglehold on macOS by dvdkon on Monday September 02, 2024 @04:20AM (#41423576)
Java is popular as a first language, but I think it's just due to its (bygone?) general popularity. I don't think a language that forces you into a one-class-per-file mindset from day one has any business being used for teaching; students should start from the basics ("commands"/function calls, if, while, for, ...) and then discover what more complex concepts do within that framework.

Java's tooling is nice, but frankly Turbo Pascal (or something at its level) is enough for beginners.

Re:Escaping from Anaconda's Stranglehold on macOS by eru on Sunday September 01, 2024 @09:09PM (#41421691)
You can teach imperative programming with OCaml or Racket, too. :)

C is indeed pretty evil, though slightly less though with modern sanitisers, so you can get a better error message than just a segfault (or silently doing the wrong thing).

Pascal isn't really more outdated than C. Especially if you use Delphi?

Python is actually fine, you can get pretty far with just the standard library, and the libraries that you can install with your Linux distribution's package manager (eg via Pacman). I do agree that package management with Python is pretty bad out-of-the-box.

Re:Escaping from Anaconda's Stranglehold on macOS by bmitc on Sunday September 01, 2024 @10:25PM (#41422127)
> Because every option sucks for teaching.

The answer is really quite simple: F#

Re:Escaping from Anaconda's Stranglehold on macOS by moi2388 on Monday September 02, 2024 @01:05AM (#41422740)
How in the world is c# too complicated? Console app, top level statements, vs code. As easy as Python. Easier because your env isn’t messed up.

If they can’t manage that they have no business doing data science or something similar to begin with

Re:Escaping from Anaconda's Stranglehold on macOS by cuddlyogre on Monday September 02, 2024 @09:56AM (#41425416)
You sound like you have been doing this for way too long to know what it takes to teach beginners.
Re:Escaping from Anaconda's Stranglehold on macOS by neonsunset on Monday September 02, 2024 @10:55AM (#41425843)
Not for complete but for beginners lightly familiar with programming it is overall not difficult to teach the basics, often easier than to stubborn seniors who want to do it their way only :)

    var start = "commtext c00\">";
    var end = "</div>";

    using var http = new HttpClient();
    var page = await http.GetStringAsync("https://news.ycombinator.com/item?id=41425416");

    var commStart = page.IndexOf(start) + start.Length;
    var commEnd = page.IndexOf(end, commStart);

    Console.WriteLine(page[commStart..commEnd]);
or

    var host = WebApplication
        .CreateBuilder()
        .Build();

    host.MapGet("/", () => "Hello World");
    host.Run("http://+:8080");
Re:Escaping from Anaconda's Stranglehold on macOS by moi2388 on Tuesday September 03, 2024 @11:55AM (#41436171)
Not at all. I still teach interns and until 2 years ago complete beginners.

I can teach them a console app with top level statements and have it running before they have installed a Python virtual environment.

Re:Escaping from Anaconda's Stranglehold on macOS by bspammer on Sunday September 01, 2024 @07:27PM (#41421210)
It’s not just the packaging situation that makes Python a bad first language. Whenever I write in Python, I find it completely impossible to stop myself from constantly making basic, beginner-level programming mistakes. Every time I miss having a compiler and strict typing that will yell at me when I’ve done something stupid.
Re:Escaping from Anaconda's Stranglehold on macOS by eru on Sunday September 01, 2024 @09:11PM (#41421704)
Modern linters and type-checkers for Python come pretty close to something usable for these situations. But it's certainly something they tacked on to the language afterwards.

I like the recent addition of (proper) pattern matching to Python.

Re:Escaping from Anaconda's Stranglehold on macOS by bmitc on Sunday September 01, 2024 @10:27PM (#41422136)
Yea, the only way to get close to programming efficiently in Python is to turn MyPy and Pylint up to 11.
Re:Escaping from Anaconda's Stranglehold on macOS by airstrike on Sunday September 01, 2024 @09:44PM (#41421884)
I switched to Rust full time about 6 months ago and recently had to write a somewhat long Python script for something else... it felt awfully quiet without the compiler yelling at me, but that also meant I was making the same silly mistakes over and over and over and over
Re:Escaping from Anaconda's Stranglehold on macOS by abdullahkhalids on Sunday September 01, 2024 @08:18PM (#41421427)
We use it because of other people use it. I would gladly switch to Julia for scientific commuting if I could.