Hi Ricky,

A couple people have said this but I'll ask again because I am curious: would it be possible to delay introduction of None entirely until it's time to introduce is?

This maybe comes down to course tactics. I happen to like doing algorithms with data arranged in 2d from the start - you can show the kind of before/after data state in a way that is easy for the students to see, to understand what their code needs to do,  and the 2d is a rich enough domain that there's a zillion algorithms you can cook up. However, in the 2d, it comes up that you need a representation for when a square is empty, and I think None is the right value for that. Students have no problems understanding the role of None.

You could use a string constant 'empty' or something as a workaround. But I think just showing the None is the right way. It's a Python course, here's a situation where None is the appropriate Python approach, so probably this is the week to show them None.

A teacher could just use strings and ints and this would not come up, but I love the 2d early for the richness of the examples and homeworks you can do with it.

Best,

Nick

On Wed, Sep 1, 2021 at 11:06 AM Ricky Teachey <ricky@teachey.org> wrote:
On Wed, Sep 1, 2021 at 1:32 PM Nick Parlante <nick@cs.stanford.edu> wrote:
In fairness to Nick, he is not talking about the real world. Nick is
talking about the hot-house environment of *education*, where fragile
newbies are generally protected from real world issues.

Let me unpack this just a teeny bit. We don't need to think of the students as fragile. Think of it as where the minutes go.

Like why is Java worse? You are trying to explain about comparisons, and you need like 30 minutes for Java where the number of different required comparison facilities is big, and it just looks needlessly complicated. What is the problem with that? Think of it this way: I wanted to talk about *algorithms* and solving real problems .. like those are the best uses of lecture time and examples. If the language injects something that you feel is not such a great use of time, you notice that those minutes are taken away from the actual course goals.

Now for Python, == vs. is nothing like that bad. Both == and is are sensible, necessary parts of the language, I would just prefer to talk about == earlier and is later. Of the two, == is the no-brainer one when the students just have ints and strings, and no-brainer is what you want in week 2.

For teaching, you are not just identifying the 500 important things they need to know. To teach artfully, you are trying to think of an ordering, layering on 50 new things each week, where the subest achieved each week is internally coherent and you can do a project just using that subset, and at the end of the course you've gotten through everything.

Best,

Nick

A couple people have said this but I'll ask again because I am curious: would it be possible to delay introduction of None entirely until it's time to introduce is?

The biggest thing None seems to be needed for beginners is to learn the idiom for function signature default arguments for mutable parameters (the classic "Least Astonishment" and the Mutable Default Argument problem).

If the goal of the course is to get as quickly as possible to  *algorithms* and solving real problems, then I don't see why you even need to teach default arguments at all.

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler