News for hackers. Stuff that matters.
Re:Python’s tug of war between beginner-friendly and advance... by retrac on Thursday February 04, 2021 @06:37PM (#26031105)
Python is great glue. But it's huge. Packed full of features. Has all sorts of syntactic sugar. It's the C++ of scripting languages. Great for an intermediate programmer who just needs to slap something together. But at the very beginning, these can actually be drawbacks because there's so very much to learn.

I would suggest something small, that you can realistically fit all in your head. I honestly believe Pascal is still an excellent choice. For something a little less low-level and more scripting-like, Lua seems nice. The JavaScript ecosystem is awkward, and there are things to criticize (no integers?) but by itself, it's a nice small language as well.

Re:Python’s tug of war between beginner-friendly and advance... by echelon on Thursday February 04, 2021 @07:08PM (#26031313)
> It's the C++ of scripting languages.

This is such a fantastic analogy. Thank you!

C++ tries to be all the paradigms, even if they're bolted on. Python is similar in that regard. Complex OO, functional, exceptions, decorators, lots of container types, iterators, generators, operator overloads... The only thing it's missing is a macro language.

Python's "batteries included" standard library stance takes it even beyond the C++ analogy in terms of sheer volume of out of the box capabilities you get.

Re:Python’s tug of war between beginner-friendly and advance... by BerislavLopac on Thursday February 04, 2021 @08:02PM (#26031809)
Python has a built-in macro language. It's called Python.
Re:Python’s tug of war between beginner-friendly and advance... by prionassembly on Friday February 05, 2021 @08:32AM (#26036086)
Checkout Hylang, a Lispish language that compiles to Python, or maybe a Lispish syntax for Python? You can write pieces of code in .hy files and import them from .py files and vice-versa.

And then you have macros like in macros that traverse and transform code.

Re:Python’s tug of war between beginner-friendly and advance... by pansa2 on Thursday February 04, 2021 @07:15PM (#26031384)
But Python still has a reputation of being a simple language for beginners. I’m not sure how that reputation endures. Is it just because of the lightweight syntax?
Re:Python’s tug of war between beginner-friendly and advance... by pjmlp on Friday February 05, 2021 @03:52AM (#26034358)
Because Python is easier to start programming with, BASIC like, but a large majority fails to actually read the official documentation.

If they would do that, then they would realize Python is as powerful as Common Lisp, Ada, C++,.... with similar doc size in pages.

Re:Python’s tug of war between beginner-friendly and advance... by type0 on Thursday February 04, 2021 @07:31PM (#26031558)
It is deceptively simple. The Python learning curve looks like a snake - https://fabienmaussion.info/acinn_python_workshop/figures/xk...
Re:Python’s tug of war between beginner-friendly and advance... by chriszhang on Friday February 05, 2021 @12:26AM (#26033414)
Does this curve really represent everyone's experience?

I never experienced the "I hate Python" phase. I think I went straight from "So exciting" to "productive" phase with Python.

Re:Python’s tug of war between beginner-friendly and advance... by prionassembly on Friday February 05, 2021 @08:34AM (#26036099)
I hated Python 2 because it did the Wrong Thing with integer division (it didn't cast to floats), so my attempts at simple scripts just didn't work.

I reencountered Python at a data science course that was somehow mandatory for my masters in ODE numerics. It has a HUGE availability of standard and third-party packages, so you can be INSANELY productive. I'd write in Brainfuck if it was the only way to have like Pytorch and giotto-tda and networkx and fastapi in the same room.

Re:Python’s tug of war between beginner-friendly and advance... by pjmlp on Friday February 05, 2021 @03:57AM (#26034381)
My only hate Python is how hard it is to push for JIT adoption versus other dynamic language communities.
Re:Python’s tug of war between beginner-friendly and advance... by Too on Friday February 05, 2021 @12:30AM (#26033431)
Back to the original question, is there any other language that doesn't look like this?
Re:Python’s tug of war between beginner-friendly and advance... by sideshowb on Friday February 05, 2021 @05:00AM (#26034696)
Why the requirement for a beginner to know their entire language? Writing code is fundamentally about making changes to a system with incomplete knowledge - abstraction, encapsulation etc. Working in the presence of unknown language features is another facet of the same thing.
Re:Python’s tug of war between beginner-friendly and advance... by retrac on Friday February 05, 2021 @11:23AM (#26037966)
So you don't get bogged down in details. There are many programmers out there who can glue libraries together but have no understanding of algorithms. If you want to focus on the CS side of it, remove all distractions.

My first CS professor insisted the first year be done all on the whiteboard. And this wasn't back in the dark ages. It was long after every student had a personal computer on their desk. Everything was done in a low-level pseudocode somewhere between Algol and C.

She felt that computers and actual programming languages would get in the way of learning the principles. I'm not quite that hardcore. But she was on to something. I learned more from that class than any other.

Re:Python’s tug of war between beginner-friendly and advance... by sideshowb on Friday February 05, 2021 @11:46AM (#26038241)
You can avoid getting bogged down by learning a limited subset of a language, though. e.g. in Python you could teach most algorithms with just conditionals and functions, and keep things pure functional using only tuples for storage. Introduce assignment, lists and loops whenever it suits you.
Re:Python’s tug of war between beginner-friendly and advance... by sideshowb on Wednesday February 10, 2021 @08:31AM (#26088761)
Coincidentally well timed - the new PEP on pattern matching would be great to include in the limited subset for teaching:

https://www.python.org/dev/peps/pep-0636/

The above tutorial is based on user input but to my mind this mechanism seems equally good for teaching recursion on data structures as you would in say, ML.

Re:Python’s tug of war between beginner-friendly and advance... by pjmlp on Friday February 05, 2021 @03:36AM (#26034281)
> It's the C++ of scripting languages.

Sorry, but Perl still wins there.

Re:Python’s tug of war between beginner-friendly and advance... by doliveira on Thursday February 04, 2021 @10:53PM (#26032907)
Pascal is nice to teach the basics, but I would be very discouraged if I had started learning something that's so rarely used in the "real world".
Re:Python’s tug of war between beginner-friendly and advance... by retrac on Friday February 05, 2021 @11:42AM (#26038194)
That's a fair point. Pascal is no longer a commercially significant language. Still, I do run into solid little projects that are written in FreePascal from time to time. Sometimes not so little.

https://wiki.freepascal.org/Projects_using_Free_Pascal