9 ms·
Python is a very intuitive and easy-to-read language for experienced programmers, but I wouldn't consider it a "beginner-friendly" one. It's packed to the brim
by CivBase 6y ago
Python is a very intuitive and easy-to-read language for experienced programmers, but I wouldn't consider it a "beginner-friendly" one. It's packed to the brim with features that are hard for beginners to understand without first coming to grips with a more simple language. Those features are extremely useful for experienced programmers who want to get stuff out the door quickly and easily, but they're overwhelming for novices. Most experienced developers I work with produce what I would consider to be pretty bad Python code - not because they are bad developers but because they haven't had enough experience with Python to understand everything it comes with out-of-the-box.
- Bostonian 6y agoWhat language would you consider beginner-friendly?
- retrac 6y agoPython is great glue. But it's huge. Packed full of features. Has all sorts of syntactic sugar. It's the C++ of scripting languages. Great for an intermediate programmer who just needs to slap something together. But at the very beginning, these can actually be drawbacks because there's so very much to learn. I would suggest something small, that you can realistically fit all in your head. I honestly believe Pascal is still an excellent choice. For something a little less low-level and more scripting-like, Lua seems nice. The JavaScript ecosystem is awkward, and there are things to criticize (no integers?) but by itself, it's a nice small language as well.
- echelon 6y ago> It's the C++ of scripting languages. This is such a fantastic analogy. Thank you! C++ tries to be all the paradigms, even if they're bolted on. Python is similar in that regard. Complex OO, functional, exceptions, decorators, lots of container types, iterators, generators, operator overloads... The only thing it's missing is a macro language. Python's "batteries included" standard library stance takes it even beyond the C++ analogy in terms of sheer volume of out of the box capabilities you get.
- pansa2 6y agoBut Python still has a reputation of being a simple language for beginners. I’m not sure how that reputation endures. Is it just because of the lightweight syntax?
- type0 6y agoIt is deceptively simple. The Python learning curve looks like a snake - https://fabienmaussion.info/acinn_python_workshop/figures/xkcd_learning_curve_wa.png https://fabienmaussion.info/acinn_python_workshop/figures/xk...
- chriszhang 6y agoDoes this curve really represent everyone's experience? I never experienced the "I hate Python" phase. I think I went straight from "So exciting" to "productive" phase with Python.
- pjmlp 6y agoMy only hate Python is how hard it is to push for JIT adoption versus other dynamic language communities.
- prionassembly 6y agoI hated Python 2 because it did the Wrong Thing with integer division (it didn't cast to floats), so my attempts at simple scripts just didn't work. I reencountered Python at a data science course that was somehow mandatory for my masters in ODE numerics. It has a HUGE availability of standard and third-party packages, so you can be INSANELY productive. I'd write in Brainfuck if it was the only way to have like Pytorch and giotto-tda and networkx and fastapi in the same room.
- Too 6y agoBack to the original question, is there any other language that doesn't look like this?
- 6y ago
- doliveira 6y agoPascal is nice to teach the basics, but I would be very discouraged if I had started learning something that's so rarely used in the "real world".
- retrac 6y agoThat's a fair point. Pascal is no longer a commercially significant language. Still, I do run into solid little projects that are written in FreePascal from time to time. Sometimes not so little. https://wiki.freepascal.org/Projects_using_Free_Pascal https://wiki.freepascal.org/Projects_using_Free_Pascal
- pjmlp 6y ago> It's the C++ of scripting languages. Sorry, but Perl still wins there.
- sideshowb 6y agoWhy the requirement for a beginner to know their entire language? Writing code is fundamentally about making changes to a system with incomplete knowledge - abstraction, encapsulation etc. Working in the presence of unknown language features is another facet of the same thing.
- retrac 6y agoSo you don't get bogged down in details. There are many programmers out there who can glue libraries together but have no understanding of algorithms. If you want to focus on the CS side of it, remove all distractions. My first CS professor insisted the first year be done all on the whiteboard. And this wasn't back in the dark ages. It was long after every student had a personal computer on their desk. Everything was done in a low-level pseudocode somewhere between Algol and C. She felt that computers and actual programming languages would get in the way of learning the principles. I'm not quite that hardcore. But she was on to something. I learned more from that class than any other.
- sideshowb 6y agoYou can avoid getting bogged down by learning a limited subset of a language, though. e.g. in Python you could teach most algorithms with just conditionals and functions, and keep things pure functional using only tuples for storage. Introduce assignment, lists and loops whenever it suits you.
- sideshowb 6y agoCoincidentally well timed - the new PEP on pattern matching would be great to include in the limited subset for teaching: https://www.python.org/dev/peps/pep-0636/ https://www.python.org/dev/peps/pep-0636/ The above tutorial is based on user input but to my mind this mechanism seems equally good for teaching recursion on data structures as you would in say, ML.
- grawprog 6y agoLua was the first language i learned where i actually started to 'get' programming. I'd tried python and a bunch of other languages before that, but lua was simple and barebones enough i could focus on learning how to program instead of how the language worked. When i tried to learn python i got caught up in trying to learn imports and classes and other things before i actually fully understood how stuff like variables, arrays and functions worked.
- sigzero 6y agoLua could benefit from a larger standard library for sure.
- grawprog 6y agoDon't get me wrong, i've got my issues with lua, it's good at what it's designed to be, a small easily embeddable scripting language that plays nice with C, but i've definitely hit some limits with lua on larger stand alone projects that make it not so suitable. Its tiny standard library, which kind of makes it limiting, I think is a boon for learning. It forces you to remake the wheel at times. Despite not being an OOP language, I learned about OOP by trying to write my own class system in lua using metatables, hitting the limits of what I could do, and looking into languages with built in classes that had all the 'things I was missing' in my own hackish OOP attempts in lua. As far as learning goes, not having the tools baked in forces you to learn about how they actually work when you have to remake them. It might not be efficient for people who just want to get the job done, but for learning it's definitely helpful. Lua's also used in a bunch of 'fun' things. It's used as a scripting language in tons of games, half the time when I look up lua stuff these days it's all about roblox...which I think is big with the kids or something...it's used in fantasy consoles like the pico8 and the tic80, it can be used to script whole games with things like LOVE and the solarus engine. Personally, I found it to be a good language overall for inspiring self-motivated learning. There's always something fun that can be accomplished with lua relatively easily.
- cforrester 6y agoI'm not the person you replied to and my perspective is pretty limited overall, but when I was younger, I found Visual Basic to be the easiest thing for a beginner. However, that's as much about the IDE as it is about the language. I remember when the Visual Studio express/community editions were first coming out. Visual Basic was a relatively simple, readable language, and the IDE itself made it simple to pick-and-place GUI components on to forms and write callbacks for them, even before I understood the concept of event-driven programming. I felt really empowered, making GUI applications that previously seemed to me like they would require years of study and experience to create.
- bobbylarrybobby 6y agoScheme is great. It has basically no syntax to bog you down and you can focus solely on the algorithm side of programming.
- chriszhang 6y agoI came here to say the same thing. A lot of the discussion with modern languages focus around syntax. Why not use a Lisp which has very minimal syntax and focus on solving problems instead? Do you have an opinion about Common Lisp? I know that Scheme is more minimal and cleaner but since you recommend Scheme I want to know what your opinion about Common Lisp is.
- pjmlp 6y agoNot the OP, Common Lisp relates to the genesis of IDEs alongside Smalltalk, as such it has a very good developer experience, alongside native compilation, which can only be fully appreciated when using the surviving commercial offerings.
- retrac 6y agoYes, I answered the question from a very different angle (Pascal or Lua) but my motivation was also avoiding the learner from drowning in syntactic details. Scheme would be even better than that.
- pjmlp 6y agoAnd good native code compilers to choose from.
- CivBase 6y agoI don't think there is one objectively best language for anyone to start with, but I'd suggest something with a relatively concise set of features so as not to overwhelm a novice or hand-wave away important details. I am very happy that I started with C. It has surprisingly few features compared to most languages and it gave me a good appreciation for how memory is managed at a relatively low level. The biggest downside was that it took me a long time to learn how to make anything I thought was "cool" at first (like GUIs, graphics, sounds, or networking). Some people might struggle with that. I rarely write C code now. It's not as practical for the kinds of things I make and I have nitpicks with it just like any other language. But I don't think that's the point. Your first programming language is an instrument for learning first and foremost. Once you've become adapt at one language, it's relatively easy to pick up more.
- mattbillenstein 6y agoMost developers produce bad code - period. And I think most Python developers that produce bad code do so because they try to use too many of the whiz-bang features - or overuse bad design patterns. You can do almost anything with functions namespaced in modules - KISS.
- deleted 6y ago[deleted]
- swiley 6y agoPython is pretty awful for beginners really. Every keyword has half a dozen meanings and invisible characters can break your program. People say scheme is hard but it is by far the easiest to teach, especially compared to Python.
- ALittleLight 6y agoI literally just finished a leetcode problem[1] to practice some python. I found two solutions, one seems more "pythonic" to me and the other seems more clear though also more verbose. Clear/Verbose - def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int: x_coords = sorted(x for x, _ in points) greatest_diff_so_far = 0 for i in range(len(x_coords)-1): diff = x_coords[i+1] - x_coords[i] if diff > greatest_diff_so_far: greatest_diff_so_far = diff return greatest_diff_so_far Pythonic - def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int: xs = sorted(x for x, _ in points) return max(x2-x1 for x1, x2 in zip(xs, xs[1:])) I'm curious which approach is bad/worse? On the one hand, the "pythonic" approach seems brief and kind of neat and I feel clever writing it. On the other hand, it is also ~20% slower per my testing, it's less obvious what it's doing, and it would be harder to make some change to the logic (or add logging/metrics) without completely rewriting it. On the one hand, just from the reasons I wrote above, it seems to me like the first way is better and the second worse, but on the other hand, the first way is what I would write while knowing zero python features. Curious if anyone else has thoughts on this. 1 - https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/submissions/ https://leetcode.com/problems/widest-vertical-area-between-t...
- panda88888 6y agoI would guess the Pythonic approach is slower due to the slicing operation, which creates a new shallow copy of the original array.
- squaresmile 6y agoInteresting, I'm using this [0] to test and got different results. The Pythonic function is 2% slower on 3.9.1 AMD 4900HS but 17% faster on 3.9.1 E5-2660 v2 VPS and 6% faster on 3.6.9 i5-3570S bare metal. I personally think either function is fine. The max finding code pattern in the long function should be familiar to most. For the Pythonic function, I don't think it's less obvious enough to matter. You have a list of stuffs and you want to find the max so you wrap it in the max function. Maybe zip(xs, xs[1:]) can take a bit to recognize but I think it's eh. For the Pythonic one, one can also write all_diffs = [x2-x1 for x1, x2 in zip(xs, xs[1:])] return max(all_diffs) Using list is also markedly faster than the Pythonic generator for me, which is to be expected: ~16% faster than both. [0] https://gist.github.com/squaresmile/8dd08898851a4e19359cdb30e0f7b843 https://gist.github.com/squaresmile/8dd08898851a4e19359cdb30...
- ausjke 6y agoI am learning python right now, Python is not only non beginner friendly, it's also not C-family(java,c++,js...) friendly(assuming most developers knew some C before taking on Python). That been said, it's versatile enough for me to continue, but calling it beginner-friendly is misleading to say the least.
- dehrmann 6y agoI disagree with it being non beginner-friendly. Too many of the resources are geared towards beginners, and its docs aren't as thorough as Java's.
- dragonwriter 6y ago> Python is not only non beginner friendly, it's also not C-family(java,c++,js...) friendly(assuming most developers knew some C before taking on Python). Python is at least as close to “C-family” as JS; it's also probably not the case that most people learning Python knew some C first, since it's been fairly prevalent in introductory classes as a first language, while C is not particularly common as an introductory teaching language anymore.
- Brakenshire 6y agoIf anyone has any recommendations for good ways to pick up this knowledge except by attrition, I’d be interested in hearing them!
- pansa2 6y agoHow to write idiomatic Python? This talk is often recommended: https://www.youtube.com/watch?v=wf-BqAjZb8M https://www.youtube.com/watch?v=wf-BqAjZb8M
- slightwinder 6y agoDoes one need to use advanced features? The interessting aspect of python IMHO is the "pseudo code"-nature of it's syntax that you already have on the basic levels. So a beginnwe need to learn only a sjort bit and can write friendly code that feature are feature can be enriched with something more advanced over time.