4 ms·
I am concerned by the number of new features that are being added to the Python language. Python is a beginner friendly language, but every new feature makes it
by ma2rten 6y ago
I am concerned by the number of new features that are being added to the Python language. Python is a beginner friendly language, but every new feature makes it a bit harder to learn.
To be honest, I kind of enjoyed that the last decade when Python was frozen at 2.7 for users most of the time.
- christofosho 6y agoI think that it is possible to be beginner friendly, while also having higher level concepts that you can learn. I actually think this is what makes it an amazing progressive language to learn. You can continue to learn new things about the language almost perpetually. 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.
- gruez 6y ago>I think that it is possible to be beginner friendly, while also having higher level concepts that you can learn. 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.
- mumblemumble 6y agoThat approach can work if you assume everyone is flying solo. 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.
- christofosho 6y agoThat logic makes sense. I am all for writing as simply as possible, and making code readable. But I understand that some may not be interested in that. I do know that some code bases tend to be more difficult to step into than others. I don't know if we can blame a language for this, or if we should be blaming the programmers. The language is a tool we can use to execute a task, but also to communicate how we are executing that task. If a developer has not written code in a way to make that obvious (or supplemented with comments), is it the fault of the language or the fault of the developer? 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.
- whalesalad 6y agoThe NIMBYism is strong in this thread. There is nothing about this feature that will make Python any harder to learn for newcomers. You can choose not to use it.
- kazinator 6y ago> you can choose not to use it 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.
- whalesalad 6y agoGotta make up your mind here - are we complaining about newcomers to the language or professionals? If you are a professional programmer there is nothing about this change that should phase you. In fact, if you are a professional Python programmer this should be an exciting addition. My argument still stands. I am so sick of people complaining about progress, especially armchair quarterbacks on HN.
- kazinator 6y agoI'm only saying that the "don't use parts you don't like" argument has limited applicability. 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.
- gustavetd 6y agoI think that pattern matching is actually more intuitive than say, decorators for example (beginners I came across usually have a hard time with those).
- bmitc 6y agoI can never wrap my head around Python being beginner friendly because as a software engineer who knows languages like Racket, F#, and Elixir, I find Python extremely confusing beyond anything basic. It’s async model (or models), where the GIL applies and doesn’t, scoping rules, class model (or again, models), decorators, etc. are all confusing and extremely complex. Given these and other quirks, it makes its dynamically typed nature a walking time bomb.
- hiq 6y agoYou listed > 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.
- cwyers 6y agoOkay, but if Python already has all of these things that are considered not relevant to beginners, why assume that these new language features are things beginners will have to deal with, instead of being like the language features they don't?
- hiq 6y agoThe feature in question matters. I don't see how you would fit async / the GIL in a beginner course. But if pattern matching is seen as idiomatic for basic code, then it should and will be introduced to beginners. For instance the switch / case construct is on https://learnxinyminutes.com/docs/java/ https://learnxinyminutes.com/docs/java/ (interestingly not on https://learnxinyminutes.com/docs/c++/ https://learnxinyminutes.com/docs/c++/ !), implying that it's quite basic there.
- bmitc 6y ago
- Blikkentrekker 6y agoPython shall be seen in the same light as BASIC and COBOL in the future: the language that taught a generation very poor programming practices it later had to unlearn.
- slightwinder 6y agoIt depends on how approachable a feature is. Is it self-explaining or cryptic. Easy or hard to explain and understand. Obvious to google even when you not know the name for it. 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.
- otabdeveloper4 6y ago> Python is a beginner friendly language Not really, no. It hasn't been beginner-friendly for a decade or so now.