Live data from Hacker News

Python should not be taught as a foundational language

thedropout.dev

61–70 of 82 posts

Re: Python should not be taught as a foundational language

#61
post #56

Earlier quoted context omitted.

> 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.

> 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. Sure, but in the non-Python languages that I use, that's not necessary, and in most cases, these days anyways, simply saving the file will fix indentation!

Instead, you have to insert a '{', move to the end of the block and insert a '}'. Or 'begin' and 'end' (or whatever delimiter is used). Some IDEs also support selecting the new block region and hitting a shortcut.

None of these are any less onerous than selecting and hitting tab.

Re: Python should not be taught as a foundational language

#62
post #41

Earlier quoted context omitted.

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.

Beginner means never wrote a program before (or maybe one in a computer class taught by a teacher with no computer science background and thus suspect ability to program). I can't imagine a beginner getting into that problem because they can't handle programs complex enough to get there.

Now the next semester... They better be moving on to bigger things where that can happen. However they have moved beyond beginner.

Re: Python should not be taught as a foundational language

#63
post #41

Earlier quoted context omitted.

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.

I'm GP in this thread but I'll give my opinion just in case you're interested.

I'm a huge proponent of static typing and I've even gone so far as to argue on occasion that Haskell is simpler for beginners than Java. In programming pedagogy I think the most important goal for complete beginners is to get them confidently writing, running, and debugging programs as quickly as possible, to get the juices of programmatic thinking flowing. DrRacket is ideal for this.

To me the problem with statically typed languages is the amount of "stuff" that needs to be hidden or glossed over for beginners. You're not going to be teaching newbies all of what "public static void main(String[] args)" means right off the bat because you're going to bore them to tears and they won't understand why they should care about any of that yet. Similarly with Haskell any interesting program is going to have "main :: IO ()" at the top of it, and explaining all of what that means involves discussing monads as well.

With Python or Racket, there are fewer of these things. You can say "this is a function" and "this is a value" and even explain how those are kind of the same thing, without having to discuss types. In dynamic languages, there is really only one type. In static languages, there are many.

I would love to see an intro CS curriculum that was type-driven, but as an educator my experience is that people want to get their hands dirty ASAP, and I want to harness that energy. If I could figure out how to discuss types in a way that gave a solid basic understanding without getting lost in the weeds I would do it, but I haven't yet, and until then the simpler, dynamic languages are better to begin with.

Re: Python should not be taught as a foundational language

#64
post #56

Earlier quoted context omitted.

> 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. Sure, but in the non-Python languages that I use, that's not necessary, and in most cases, these days anyways, simply saving the file will fix indentation!

Instead, you have to insert a '{', move to the end of the block and insert a '}'. Or 'begin' and 'end' (or whatever delimiter is used). Some IDEs also support selecting the new block region and hitting a shortcut. None of these are any less onerous than selecting and hitting tab.

I've had editors or git merges mess with whitespace. I've never had editors remove braces or begin..end blocks, and merges have rarely caused issues with begin..end blocks or braces. apples and oranges , in this case.

Re: Python should not be taught as a foundational language

#65
post #63

Earlier quoted context omitted.

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.

I'm GP in this thread but I'll give my opinion just in case you're interested. I'm a huge proponent of static typing and I've even gone so far as to argue on occasion that Haskell is simpler for beginners than Java. In programming pedagogy I think the most important goal for complete beginners is to get them confidently writing, running, and debugging programs as quickly as possible, to get the juices of programmatic…

What are your thoughts on handwaving away "public static void main(String[] args)"?

It's been a while, but when I learned programming initially, I remember being told something along the lines of "This tells the program where to start. Copy and paste it for now, and we'll to what it means later on." If there was a way to get the best of both worlds, that would obviously be ideal, but IMO, this is a fine sacrifice for students being deliberate about the types of their variables.

Clearly new students shouldn't get crazy on types etc early on, but I'd definitely see someone trying '5' + 5 early on, or end up in a hard to debug situation like that. For example, returning a string from a function in one instance, and an integer in another. Instead of getting a failed addition at runtime later out and outside of function that causes the issue, the compiler can tell the student that they're returning a string, in a function that the student has explicitly stated returns an integer.

Re: Python should not be taught as a foundational language

#66
post #62

Earlier quoted context omitted.

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.

Beginner means never wrote a program before (or maybe one in a computer class taught by a teacher with no computer science background and thus suspect ability to program). I can't imagine a beginner getting into that problem because they can't handle programs complex enough to get there. Now the next semester... They better be moving on to bigger things where that can happen. However they have moved beyond beginner.

I could see an intro python student running into this issue with something like the following. I think we have different views on how far a beginner class would go, but I think doing basic functions and comparisons would be included.

  def foo(input_val):
     if some condition:
         return '5'
     else:
         return 6

  print(foo(some_val) + 1)

Re: Python should not be taught as a foundational language

#67

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…

That's why I started my kids off reading James Joyce. Once they learn to manage their vocabulary and really grasp how grammar is supposed to work, then they can read Dr. Seuss without picking up any bad habits.

Sure my kids are teenagers and have never finished reading a book, but they'll be great authors once they do.

Re: Python should not be taught as a foundational language

#69

Earlier quoted context omitted.

> None of ecosystem, long term ownership, iteration, or codebases at scale are relevant to a foundational language (i.e. one that is being taught in order to teach the concepts of programming.) I cannot agree with this. Embedded in this argument is the idea that syntactic specialization towards pedagogy is a worthwhile goal rather than ramping up a pupil towards where they'd be able to function independently as a sof…

In an educational setting you need to be clear whether you're talking about Computer _Science_, _Engineering_ or trade. There is value in all 3 approaches but don't make the mistake of thinking they're all the same. Using the term "foundational language" makes me think Science, which has very little overlap with the trade approach. An engineering approach stands somewhere in between, but still has very different obje…

> There is value in all 3 approaches but don't make the mistake of thinking they're all the same.

I respectfully disagree, and would gladly take the counterpoint to that argument. You will find the intersection of the three inside of many real world engineering problems. On the contrary, I am skeptical of the idea that applications in any one particular area don't have corresponding mirror images in the other two. Based on achievements in all three (research, engineering and trade), it is my opinionated belief that a focus on the intersection is where you create compounding value. I would love to hear a compelling counter-argument.

Re: Python should not be taught as a foundational language

#70

Ok. Had to stop reading after the first paragraph. Python is not dynamically typed. Try doing print("Answer is:"+42) and the interpreter will not try to save you. Dynamic assignment != dynamic typing.

It is dynamically typed, because the typing is checked at runtime. Unlike a lot of other dynamically typed languages though it is strongly typed, because it does enforce type rules as you pointed out. That's not to say there's not a whole heap of other issues with this article though.
Post reply on HN