[Tutor] Tungsten teaching method

ThreeBlindQuarks threesomequarks at proton.me
Fri Jul 14 14:09:47 EDT 2023


I have been wondering about some of the newer python learners in terms of how they approach learning. This is not really about just python but all kinds of languages.

Do you start with the basics as in the kinds of constructs many earlier programming languages have. I mean define basic types like integer, floating point and character/text. Teach how to do simple assignment statements, then IF statements (or even weirder GOTO) and loop constructs like WHILE or FOR or whatever, then learn how to create functions, perhaps make simple objects and maybe eventually how to treat functions as first class objects.

In other words, do you teach loosely simple parts of procedural programming then perhaps introduce object oriented and functional and perhaps other methodologies, including teaching about assorted libraries/packages/modules that extend the language?

I think some here have learned vaguely along these lines and some quite differently. Some skip learning much and just look at snippets of code, perhaps in internet searches and try to figure things out. Some would prefer to search for pre-built software, as in publicly shared modules, that already do 90% of what they want.

So I decided to learn another language called WOLFRAM. I am not suggesting anyone here do so. I just am using it to illustrate some points. In a sense, this language is a successor to Mathematica and is a very high-level language that is hard to characterize. It comes with at least 6,000 functions built-in as in not needing to be imported. It is by Stephen Wolfram, hence the name that means Tungsten which is why the chemical symbol is W. The book is from 2015 and is called An Elementary Introduction to the Wolfram Language.

What got me is that for an ELEMENTARY text, it skips all the elementary parts. It seems to practically jump into functional programming from the start and only about 2/3 of the way through the book is there a mention of a kind of IF statement. No real mention of loops as everything sort of had loops built-in one way or another. I still have not seen examples on how to setup a variable and assign to it or create a function other than an immediate inline (anonymous) function let alone how to create an object. I know it all has to be THERE but you can apparently do an amazing amount in this language by simply calling one of the many built-in functions appropriately, often in a nested fashion.

So, no, not suggesting it as a first language.

The point here is that we often have little idea about the person asking a question and their background. There can be a temptation to simply give them an answer, sometimes an elegant answer using advanced features. Several of us recently tried coaching someone to fix their code and work through learning how to solve a problem. Someone else just supplied working code. Now if someone asked Wolfram how to say determine if a number is prime, rather than suggesting some technique using an algorithm, they would just suggest using PrimeQ[number] and voila! (In that language, you use square brackets in function calls.) If they were then asked how to check a whole list of numbers that way, do you think they would show any visible loops? Nope. I will spare the details but in effect they would apply a function to a list returning the list of results. If you want just the ones that are prime, you can use a sort of embedded if statement. One-liners seem to be the norm. And perhaps odder, the language is merely a part of a larger entity that includes a gigantic knowledge base on the internet that it automatically taps into so your program can literally ask in plain English for things like the populations of countries embedded in a request to make some complex plot displaying them.

Python though is actually many paradigms in one. You can actually do quite a bit similar to what I described if you focus on a combination of functional programming and some object-oriented programming and are a bit more verbose. But if you want to learn how computers work on a basic level and then get into higher abstractions, it is very good. Some of what I describe is in there if you know where to look. You can use plain loops, then as syntactic sugar you can use comprehensions or perhaps generators and of course you can use functional programming, including the kinds of tools you can get in the itertools module that automate lots of stuff for you.

In this forum, I suspect that unless asked otherwise, we ought to remain in the lower levels. And I don’t mean the meaning of Elementary of someone like Stephen Wolfram! LOL!


More information about the Tutor mailing list