Live data from Hacker News

Python should not be taught as a foundational language

thedropout.dev

41–50 of 82 posts

Re: Python should not be taught as a foundational language

#41
post #5

Python is far simpler than Java in its essence; you aren't required to write class and access control boilerplate if you don't want to, you don't have to explain type systems, and the syntax is much cleaner. I would personally recommend Racket/Scheme as the foundational language for computer science and software engineering over Python as it is even simpler, but I can understand why Python has displaced Java as the d…

> you don't have to explain type systems Is that a feature though? Beginning programmers are still going to hit type errors, and having things be explicit and static I think would help, IMO.

They will, but that is an intermediate topic that can be deferred out of the beginners class. Beginners can write many interesting programs without hitting those type problems.

Re: Python should not be taught as a foundational language

#42
post #39
post #11

Terrible article. Looks like it's written in 2004? I've been using Python 3+ for the past few years, never looked back. > Python decided it would be a fun idea to govern blocks using whitespace, instead of wrapping everything in braces. Yeah, because using braces was a stupid idea in the first place. Just because C++ / JavaScript etc. are stuck with backwards compatibility, doesn't mean that other languages can't mov…

Whitespace is a terrible idea. I'm not saying languages need to use the one true brace (which every brace you care to argue for, they are all the same, at least for this point), but there needs to be a start and end block, and white space is one of the worst choices you can make. The problem with whitespace is in real programs you eventually realize (often because of a new requirement) that you need a new block and w…

> whitespace is hard to change

What text editor are you using? Select region, Tab or Shift-Tab, and move on.

> Whitespace is a terrible idea.

That’s like, just your opinion man.

The only time I’ve had issues with blocks and whitespace is when some monster mixed in tabs. Thankfully every decent editor can make whitespace characters visible, and a quick find/replace fixed the heinous action.

Re: Python should not be taught as a foundational language

#43
post #39
post #11

Terrible article. Looks like it's written in 2004? I've been using Python 3+ for the past few years, never looked back. > Python decided it would be a fun idea to govern blocks using whitespace, instead of wrapping everything in braces. Yeah, because using braces was a stupid idea in the first place. Just because C++ / JavaScript etc. are stuck with backwards compatibility, doesn't mean that other languages can't mov…

Whitespace is a terrible idea. I'm not saying languages need to use the one true brace (which every brace you care to argue for, they are all the same, at least for this point), but there needs to be a start and end block, and white space is one of the worst choices you can make. The problem with whitespace is in real programs you eventually realize (often because of a new requirement) that you need a new block and w…

This makes no sense to me. The whitespace is controlling. There is no need to retroactively "fix" it because if it's wrong, the program won't work.

Re: Python should not be taught as a foundational language

#44
Here is an article that I would be completely ready to agree with the premise, but then the author completely botches it by using only wrong reasons to make his argument: scoping, list-vs-array and map-vs-dict, whitespace?!

Really? Python is not a good foundational language because it is meant to be practical. When you are learning the foundations of things, you should be exposed to the damn thing you are learning. Python's main strength is that it abstracts all of this fundamental things away from the application developers and let's you be productive on the application side. When you are studying the fundamentals of Computer Science, though, your focus should be on the basics. For those, there are so many better choices than Python.

Python fails to teach lambda calculus like Scheme or Common Lisp, so you shouldn't be use it to learn functional programming. It does not have any interesting constructs for declarative programming like Prolog. It hides all of the hardware complexity under its VM, so you can't learn about data structures, file structures or algorithm analysis like you would with C, Pascal or any Algol-like language.

So, yeah, of course it should not be used as a language to teach Computer Engineers and CS majors. But scoping, naming conventions and fucking whitespace are completely irrelevant.

Re: Python should not be taught as a foundational language

#45
My spouse expressed interest in learning to program and I thought the best way to start would be with Python as it would be the code structure without all that extra boilerplate, and doing simply things in Python is easy. I'm coming to realize that the boilerplate is important. She's struggled a bit with a lot of the things that are explicit in other languages. Variables are just magic in Python - in other languages there's a structure for their creation. I think that structure is important to understand and helps to formalize how things work - it helps build up mental models that just doesn't exist in Python.

I don't agree with the article on a lot of thing - I think the string criticisms are splitting hairs (and aren't all string in 3+ unicode by default?), naming quirks are in every language, and the version split can be treated as a non-issue (just learn 3.8 and if you have to learn the quirks for 2.x to support that version). I do agree with the scope - I think curly braces are easier to visualize and less magic. It's the magic that's kills the beginner experience.

Re: Python should not be taught as a foundational language

#46

Reasons why Python is great to teach: * Simplicity - you can write Hello world and have a 'that's cool' moment earlier than java * General purpose - whether you're interested in web apps, data analysis, games, command line apps, you'll be able to do it with Python (the 'second best language for any problem' aspect) * Community - a lot of people know it, it's easy to get questions answered. There are libraries, tutori…

> Horrible set up

For the purposes of teaching, there’s very few reasons to go beyond the standard library (‘Requests’ is why I qualify this). Restricting yourself to that means that python is, most times, already set up for you. It only gets confusing when you start to use shared libraries.

Re: Python should not be taught as a foundational language

#47

C should be the only foundational language. People should first learn to manage their memory, ensure their typing and the boundaries of their variable allocations before having someone do that for them. It's a little bit like driving: in the US you can get a driver's license without ever touching a stick shift car, so you have this huge driver population than can only drive automatics. Which is fine for the general p…

Certainly x86 Assembly should be the only foundational language. People should first learn to manage their registers and memory addresses, ensure their typing and the boundaries of their variable allocations before having someone do that for them. It's a little bit like driving: in the EU you can get a driver's license without ever touching the horse saddle, so you have this huge driver population than can only drive…

People should start with a pile of sand from which they extract pure silicone, then design a cpu with whatever they want. Registers are cool, but you can design a cpu without them if you want. Then the rest of the computer and an Io system (Io is not required, but the instructor needs some way to validate your cpu)

The next step is to design your own language for your cpu, but so far human life isn't long enough.

Re: Python should not be taught as a foundational language

#48
I think languages like Python (and IMO Javascript) are perfectly fine as first languages, since it's easy to setup and the basics are easy to learn which is important in not discouraging people from hating coding. That's what I recommend to people who are interested in programming but have little to no experience doing so.

There's also a lot of fun tutorials out there which make learning the language feel fulfilling and enjoyable. And it can be hugely helpful in the job market.

However, I'd say I didn't really start leveling up as a developer till I spent time learning a statically typed language. In my particular case, I think it was partially because C++/Rust developers spent a lot of time discussing performance implications in podcasts/forums/lectures, which inevitably lead me down rabbit hole of how software interacts with hardware. I think that's harder to do in languages which abstract away some of the complexity.

Re: Python should not be taught as a foundational language

#49
post #39
post #11

Terrible article. Looks like it's written in 2004? I've been using Python 3+ for the past few years, never looked back. > Python decided it would be a fun idea to govern blocks using whitespace, instead of wrapping everything in braces. Yeah, because using braces was a stupid idea in the first place. Just because C++ / JavaScript etc. are stuck with backwards compatibility, doesn't mean that other languages can't mov…

Whitespace is a terrible idea. I'm not saying languages need to use the one true brace (which every brace you care to argue for, they are all the same, at least for this point), but there needs to be a start and end block, and white space is one of the worst choices you can make. The problem with whitespace is in real programs you eventually realize (often because of a new requirement) that you need a new block and w…

I disagree, but in any case this is a better criticism than what's written in the original article.

First of all, whitespace is the reality. The only relevant choice is for the compiler to consider it, or ignore it. You're arguing "wrong whitespace is error" so I guess we agree there.

My main job is Python, and there's not a lot of work I need to do to fix the whitespace. It's literally a few Tabs / Shift+Tabs away! IDEs help a lot, the worst are REPL-like tools (Python's command line interface, or Jupyter) that fail to automatically remove leading whitespace in copy-pasted lines.

Python goes a long way to helping tools by having the `:` (colon) as "new block" signal. I personally think that's superfluous, and it should be done away with.

The broader point is, there are (or should be) techniques that eliminate these problems altogether; copy-pasting text is the problem - we should be copy-pasting AST instead. Same issues would happen e.g. in C++ if you copy-paste on `{` too much or too little... Copying AST instead of text would solve that as well.

Re: Python should not be taught as a foundational language

#50
post #41

Earlier quoted context omitted.

> you don't have to explain type systems Is that a feature though? Beginning programmers are still going to hit type errors, and having things be explicit and static I think would help, IMO.

They will, but that is an intermediate topic that can be deferred out of the beginners class. Beginners can write many interesting programs without hitting those type problems.

What do you consider as the content present in a beginners class? I'm not personally involved in teaching (possibly changing in the future!), but I can definitely imagine a student accidentally writing a function that returns different types based on the input, and having an incredibly difficult time of it.
Post reply on HN