To be honest, I kind of enjoyed that the last decade when Python was frozen at 2.7 for users most of the time.
To be honest, I kind of enjoyed that the last decade when Python was frozen at 2.7 for users most of the time.
> async model
> GIL
> scoping rules
> decorators
but these are not relevant for a beginner in programming, which is I think what advocates refer to.
Python makes it easy to read files, do something with the content and write it back, to print any variable. It runs even if you have syntactic errors in an unused function. A beginner's Python code can be dirty, but I think one reason why it's taught so often is because it's less frustrating to fix runtime bugs than cryptic compilation errors you see in safer languages, although as you said, it's detrimental to the code quality in the long run.
For instance the switch / case construct is on https://learnxinyminutes.com/docs/java/ (interestingly not on https://learnxinyminutes.com/docs/c++/ !), implying that it's quite basic there.
Plenty of languages make it very easy to read data from a file, process it, and then write it back out. F#, Elixir, Racket, LabVIEW, etc. all come to mind.
I understand arguments that simplicity means easier to learn, but also think that in most subjects in life we start with the basics and then break those rules to add nuance and continued expansion to the topics. See math, language, science.
I mean, you can say that about C++. You use it like C (it's a superset of C, after all), and gradually learn the features (STL, template meta-programming, polymorphism, etc.) as you go along. But I doubt that many would say c++ is beginner friendly.
As soon as you get into a team setting, though, all these advanced features become a way for more advanced users to unwittingly create a hostile environment for less skilled programmers.
Which maybe isn't a big deal in the software engineering department, where you can perhaps assume that everyone is a crack programmer. It can be a huge deal, though, for a lot of non-software-engineer departments that still spend a lot of time working with code. Those teams tend to be heavily dependent on languages like Python.
Of course, by extension, some languages have more complicated syntax (perhaps "less intuitive" based on languages you may be used to).
All said, I agree with you that some developers will indeed use higher level concepts which may not be understood immediately by lower level developers. I think this would occur even without those concepts embedded in the language itself, as the higher level developer would need create a solution to solve the problem anyway.
I hear this a lot about features in Python. Type hints, dataclasses, walruses, and now pattern matching. Whenever someone complains about language bloat, the reply is “it’s optional”.
But that’s only true as long as you’re writing code by yourself. Most developers spend much more time reading code than writing it, and with no control over which features others use, it’s necessary to be comfortable with the entire language.
What's more, you can even choose not to understand it. An easy way to do that is to choose not to work with other people's Python code.
Don't apply for Python jobs, and in a non-Python job, dodge tasks that involve touching Python code that contains constructs you don't wish to understand.
My argument still stands. I am so sick of people complaining about progress, especially armchair quarterbacks on HN.
We have to acknowledge that some newcomers are eager to learn everything, and that a bigger everything is harder than a smaller everything.
That's just a fact; it doesn't meant that a smaller everything is better.
Now that Python has pattern matching, newcomers should learn it.
In my opinion, newcomers should learn pattern matching before they learn lower-level, more verbose ways of writing code for classifying objects for type, shape and content.
The more verbose code should be the appendix, like "in older Python before pattern maching, we would have had to write it like this ...".
Or, to put it alternatively, newcomers no longer should learn how to use basic primitives like if comparisons and whatnot, to write code which combines multiple tests for object type, shape and content in multiple cases. They should be steered toward pattern matching, with a caution about how that is new and doesn't work with Python versions lower than x.y.z.
Pattern matching is particularly good for beginner programmers, because beginners programmers are not good at planning the design of a program ahead of time: they don't have an intuition for the right data structures and such. Pattern matching can patch over some representational difficulties/tensions in the program so that the code looks good and is easy to reason about and debug.
If all you have is a switch/case type statement, you might be told that, at some point, the pain you're feeling is from abusing that and should switch to something else, like proper OOP. In some of those same situations, you could instead switch to pattern matching. Pattern matching is less abstract and more literal-minded, since it uses "pictures" of data, which can overcome disparities in its structuring in a way that looks obvious in the code. Pattern matching has processing "under the hood", but what that does is not only largely intuitive, but also localized to the spot in the program where it is happening. I believe all of that favors the skill level of newbies.
The pitfalls in this miserable implementation are another story, but I think that will only help Python. Pitfalls bring Python people together to form communities and help each other. People band together and cooperate when they have common enemies, like sabre-toothed tigers, inclement weather or shitty programming languages and systems. The six-week-old Python newbie is eager to explain the quirks of pattern matching to the day-old newbies, and so it goes.
Other than the Python-specific quirks, newbies will likely struggle with bugs involving the order of pattern matching cases, when they place a more general case before a more specific one, such that it unexpectedly takes some (or even all) matches from that one. Adding new cases to a pattern matching block ahead of existing cases is tricky, if they match anything in common.
With pattern matching, you can write a small amount of code that handles a lot of ad hoc complexity---and if that doesn't have test coverage, that can spell trouble.
At least with unknown syntax there's usually some kind of keyword you can look up with Google. It's generally the non-syntactic sorts of unknowns that are much harder to figure out for a given codebase.
The quality of this proposal is much lower than other new features of the last decade.
In those regards most new python 3-features are more on the good side. I know how often I googled for old python features like string substitution (the %-thing) or list comprehensions (the loop inside []) and I just could not figure out and remember the names, because % and [] are simply not self-explaining.
Not really, no. It hasn't been beginner-friendly for a decade or so now.