by rightbyte · 4y ago · 0 comments
It is not possible for a from zero beginner to read ordinary Python code with decorators, generators or what not and understand it.
Way too many concepts.
It is being choose by intertia at this point and have been ruined for the original target user by former target users who are now professional programmers using it at work.
As an introduction language, I don't see why you would need to use decorators, generators or anything? You don't need to learn control flow, functions, variables, etc. You can perfectly write python without all the fancy stuff. In fact, there are quite a lot of data scientists who are paid to write python and don't know the first thing about concepts as seemingly basic as classes.
I think the point here, is that when beginners start exploring what's out there in "professional" lands they'll quickly discover that they don't know Python at all, because they were using this primitive subset of a language.
I don't see why not. Plenty of folks learn on the job, including new languages, and the way things work out you might end up implementing some things sort of by kitbashing, knowing relatively little of the concrete details that you end up learning completely more later on. I do this all the time.
go, but that brings along its own set of bug bear problems
But after 30 years of programming, do I actually know C? Once I dig into C compilers, undefined behaviors, etc. I can also quickly convince myself I actually don't know C at all...
Python grew up and has been chosen to solve a lot of complex, important problems. This has lead to the language ballooning to become not just good but excellent for those problems (data science). Some of it might be fluff; much of it might not be relevant to your style or problem space.
2.x and 3.x seem to be diverging philosophically, and I'm not convinced that's a good thing.
Having taught beginners both python and other languages, I’d say it’s significantly easier to teach decorators than it is to teach higher order functions normally. Because in python the students have already seen, used and understood what the cache decorator does before we even touch the concept of a function returning another function, which they always need some time to grok, both in python and other languages.
As for generators I’ve never seen anyone struggle with them. What do you find difficult to understand about generators?
How one could solve this i don't really know, generators are such useful concept that you can't really remove them either, and you still want them to be compatible everywhere other lists and iterables are. Even with type hints, it's not exactly obvious when you type the code whether a certain variable is a generator or a concrete list, both of them mostly adhere to the same protocol.
And when they've learned the basics on toy stuff and want to start writing real-world apps, that is when you explain decorators, generators etc. And yet they don't have to switch to a whole new language - all the basics they've learned still work exactly as they did before.
A go-kart is easier to learn and to drive than a Formula 1 car.
I would not call python a go-kart I would call python a mini-van. Boring and looked down upon, but is the best vehicle around for doing your daily activities in.
This absolutely provides a good foundation to learn lower level concepts later, although going bottom-up and starting with a language like C is also a valid path.
It’s also worth noting that a large proportion of developers will never learn C++, and will stick to higher level languages their entire career. And another chunk will only learn the lower level stuff much later when they have many years of experience to lean on.
If your goal is to immediately become a C++ developer, then you should learn C++, but that isn’t most people learning to program.
I wonder if whether this is a blessing or a curse depends on the person who is learning it. For instance, my first language was BASIC in 1981, and so my gut reaction to discussions about learning languages is that BASIC lets you at least imagine the workings of the machine that's running your program. The teacher can draw boxes on the blackboard to explain 10 LET X = X + 1
And we weren't far from the machine. There were not very many turtles on the way down to the level of logic gates. I also learned how a microprocessor worked, reading books as a high school kid, and articles in Byte Magazine, something that would be laughable for today's big CPU's.
That's a bottom-up approach. For others, a top-down approach might be better, e.g., seeing mathematical equations develop, in beautiful notation, without caring what the machine is doing under the hood.
Another comment in this thread mentions the ability to read code. Python has sprawled. I've been coding in Python for 10 years (as a "scientific" programmer) and recently took a Python skills quiz. I mentor beginners. Yet I scored barely at the top of "average." I can't read the code that's in a lot of the more elaborate Python packages.
A problem is motivating people to learn a learning language when they know that they'll outgrow it.
Sure, you can teach students to write `print(" ".join(str(x) for x in range(1, 11)))` to print numbers from 1 to 10... but you don't have to do that. In fact, `X = X + 1` works just fine. The old school BASIC style like `X = 1; while X <= 10: print(X); X = X + 1` still works in python. (sorry for the lack of indentation)
What am I missing? (besides the misguided social expectation that you need to teach the fancy generator stuff to a total beginner...)
I do agree that Python provides a very small startup cost to writing code, the details are sacrificed to acheive this. This may be useful to capture interest/generate motivation and get a quick prototype/"helloworld" out, learning Python is only good for learning Python, not for programming in general.
> Even strings blur the line between individual characters and actual strings
IMO that's better than what C++ does, where it pretends that a character is a single byte. Whereas most code nowadays is using unicode, which means that code will break as soon as they try to store a non-ascii character in it.
If I was teaching beginners I’d do 1/3 python assignments and 2/3 C.
They need some easy wins at the start and to learn control flow and basic concepts. But mixed in with that we’d do C and learn what’s happening under the hood.
The easy wins are so key. I remember my intro class and we had to just copy some C++ code and compile it. Even though I felt like I copied the code exactly I got these incomprehensible error messages and just felt overwhelmed.
I actually quit the class after feeling like nothing would work and not having any fun.
Only years later doing a project in Visual Basic did I realize coding could be fun.
You could choose a subset of C++ or just teach C (which would be my preference)