News for hackers. Stuff that matters.
Re:Python’s tug of war between beginner-friendly and advance... by Bostonian on Thursday February 04, 2021 @06:32PM (#26031067)
What language would you consider beginner-friendly?
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

Re:Python’s tug of war between beginner-friendly and advance... by grawprog on Thursday February 04, 2021 @06:38PM (#26031111)
Lua was the first language i learned where i actually started to 'get' programming. I'd tried python and a bunch of other languages before that, but lua was simple and barebones enough i could focus on learning how to program instead of how the language worked.

When i tried to learn python i got caught up in trying to learn imports and classes and other things before i actually fully understood how stuff like variables, arrays and functions worked.

Re:Python’s tug of war between beginner-friendly and advance... by sigzero on Thursday February 04, 2021 @11:23PM (#26033079)
Lua could benefit from a larger standard library for sure.
Re:Python’s tug of war between beginner-friendly and advance... by grawprog on Friday February 05, 2021 @12:15AM (#26033377)
Don't get me wrong, i've got my issues with lua, it's good at what it's designed to be, a small easily embeddable scripting language that plays nice with C, but i've definitely hit some limits with lua on larger stand alone projects that make it not so suitable.

Its tiny standard library, which kind of makes it limiting, I think is a boon for learning. It forces you to remake the wheel at times. Despite not being an OOP language, I learned about OOP by trying to write my own class system in lua using metatables, hitting the limits of what I could do, and looking into languages with built in classes that had all the 'things I was missing' in my own hackish OOP attempts in lua.

As far as learning goes, not having the tools baked in forces you to learn about how they actually work when you have to remake them. It might not be efficient for people who just want to get the job done, but for learning it's definitely helpful.

Lua's also used in a bunch of 'fun' things. It's used as a scripting language in tons of games, half the time when I look up lua stuff these days it's all about roblox...which I think is big with the kids or something...it's used in fantasy consoles like the pico8 and the tic80, it can be used to script whole games with things like LOVE and the solarus engine.

Personally, I found it to be a good language overall for inspiring self-motivated learning. There's always something fun that can be accomplished with lua relatively easily.

Re:Python’s tug of war between beginner-friendly and advance... by CivBase on Thursday February 04, 2021 @10:45PM (#26032865)
I don't think there is one objectively best language for anyone to start with, but I'd suggest something with a relatively concise set of features so as not to overwhelm a novice or hand-wave away important details.

I am very happy that I started with C. It has surprisingly few features compared to most languages and it gave me a good appreciation for how memory is managed at a relatively low level. The biggest downside was that it took me a long time to learn how to make anything I thought was "cool" at first (like GUIs, graphics, sounds, or networking). Some people might struggle with that.

I rarely write C code now. It's not as practical for the kinds of things I make and I have nitpicks with it just like any other language. But I don't think that's the point. Your first programming language is an instrument for learning first and foremost. Once you've become adapt at one language, it's relatively easy to pick up more.

Re:Python’s tug of war between beginner-friendly and advance... by cforrester on Thursday February 04, 2021 @06:39PM (#26031124)
I'm not the person you replied to and my perspective is pretty limited overall, but when I was younger, I found Visual Basic to be the easiest thing for a beginner. However, that's as much about the IDE as it is about the language. I remember when the Visual Studio express/community editions were first coming out. Visual Basic was a relatively simple, readable language, and the IDE itself made it simple to pick-and-place GUI components on to forms and write callbacks for them, even before I understood the concept of event-driven programming. I felt really empowered, making GUI applications that previously seemed to me like they would require years of study and experience to create.
Re:Python’s tug of war between beginner-friendly and advance... by bobbylarrybobby on Thursday February 04, 2021 @07:56PM (#26031773)
Scheme is great. It has basically no syntax to bog you down and you can focus solely on the algorithm side of programming.
Re:Python’s tug of war between beginner-friendly and advance... by chriszhang on Friday February 05, 2021 @01:24AM (#26033661)
I came here to say the same thing. A lot of the discussion with modern languages focus around syntax. Why not use a Lisp which has very minimal syntax and focus on solving problems instead?

Do you have an opinion about Common Lisp? I know that Scheme is more minimal and cleaner but since you recommend Scheme I want to know what your opinion about Common Lisp is.

Re:Python’s tug of war between beginner-friendly and advance... by pjmlp on Friday February 05, 2021 @04:00AM (#26034395)
Not the OP, Common Lisp relates to the genesis of IDEs alongside Smalltalk, as such it has a very good developer experience, alongside native compilation, which can only be fully appreciated when using the surviving commercial offerings.
Re:Python’s tug of war between beginner-friendly and advance... by retrac on Friday February 05, 2021 @11:46AM (#26038239)
Yes, I answered the question from a very different angle (Pascal or Lua) but my motivation was also avoiding the learner from drowning in syntactic details. Scheme would be even better than that.
Re:Python’s tug of war between beginner-friendly and advance... by pjmlp on Friday February 05, 2021 @03:58AM (#26034384)
And good native code compilers to choose from.