r/learnpython • u/[deleted] • Sep 17 '20
For any programming language, how far can you go by just knowing the basics? How more advanced does it get?
So I’ve had a bit of experience using JavaScript as I worked as a web developer for experience. I didn’t go too far into it before I left and got a new job where I learn Python now. But what I’ve realised is, all the languages of course do all the basic foundations like arithmetic, lists, loops. And I was wondering, how much further on in terms of learning does it go? Because I found in my web developer role that most of my tasks were solved by just using these basics they teach you at the start. And the only “advancedness” of it was just how creatively you could think about how to manipulate the code to solve your problem.
Is this really all there is and any new code you learn is really just a step forward in these basics? Or is it a whole new area that I’ve not even scratched the surface of yet?
42
u/GalacticSuperCheese Sep 17 '20
You are right in the sense that most problems can be solved using basic knowledge of a language. Having said that, digging deeper is required to come up with elegant solutions to complex problems - solutions that require less code and are more efficient. Also greater knowledge means that you can take advantage of advanced language features that result in much faster code.
A couple of examples of somewhat advanced features of python are things like List Comprehensions and Generators which really take your code to a new level.
Usage of constructs like
for thing in list_of_things:in place of
for i in range(len(list_of_things)):
thing = list_of_things[i]
...are not only easier to understand but much faster. The examples are endless but I am sure you get the idea.
So, to answer your question, yes there are tons of things beyond the basics that you should be learning. Also keep in mind that this applies to any language you use and learn.
4
Sep 17 '20
Thanks for your answer! So for the most part, in terms of advancedness, it is really building on concepts that have already been introduced at your foundations and making them more elegant and less so of learning entirely new concepts that you’ve never seen before?
3
u/GalacticSuperCheese Sep 17 '20
Most basic concepts (conditionals, looping, etc) are quite similar in most languages; using the best algorithm or basic concepts (like difference between
ifandwhile) takes some practice and experience and in some instances is down to personal preferences.Language specific constructs (like list comprehensions in python) are concepts you will have to learn.
Other things you have to learn is which external library to use in what scenarios (e.g. numpy or pandas); each one of these libraries will also require some effort to learn the best usage etc.
2
u/ccr10203040 Sep 17 '20
What would you recommend to anyone that has gone over Python basics already?
2
u/entanglemententropy Sep 17 '20
There's a nice book called Fluent Python that goes over a lot of really neat more advanced features and a little how Python works 'under the hood'. The video linked in the top comment is also nice.
1
3
u/GalacticSuperCheese Sep 17 '20
Learn some more basics :) I'd recommend looking up Raymond Hettinger on YouTube (especially beyond PEP8).
Write a lot of code, and when you get stuck (which you will) look up your problem on Google (or your search engine of choice) and you'll probably learn 2 or 3 new things. Repeat forever!
1
u/ccr10203040 Sep 17 '20
I really want to learn how to write more pythonic code. And get the hang of object-oriented python.
1
u/thrallsius Sep 17 '20
Idiomatic python like your example is really a de facto standard. I believe the second pattern would rather be used by someone with experience in another programming language that does things this way.
There are much more complex python things that can be considered advanced.
0
Sep 17 '20
[deleted]
7
u/GalacticSuperCheese Sep 17 '20
Yet you'd be surprised to see how many people do it incorrectly, especially those who already know another language.
2
u/NewShamu Sep 17 '20
Yeah I didn't use
for inloops like that for a long time because I came from a C/Java background and that was the only way I knew how to do for loops haha. It's funny, I've been using Python long enough now that it feels so inelegant whenever I have to userange().2
u/MonsterMeggu Sep 17 '20
Im definitely guilty of doing the second. I just started using Python instead of java one day and didn't learn the pythonic way to do things.
2
u/ErinMyLungs Sep 17 '20
I've done the second when I've had to iterate through multiple lists at the same rate because I didn't know itertools or about zip.
You can do a ton of stuff in python even if your knowledge of it is super shallow. And honestly I think that's pretty great.
86
Sep 17 '20 edited Sep 17 '20
I've been coding Python at work for 9+ years and I still only know the basic. At least that's what I feel about myself. I would try figuring out the logic of the script I needed, and Google almost 90% of things I needed Python to actually do. Even simply read/writing text/csv/json.... I still need to Google that.
I've watched tons of videos, read tons of articles, dived into tons of documentation. When I needed to do something, my first thought has always been this "I've seen/read about this somewhere"... very rarely would I be able to just code it out.
Weird I know...
39
u/GalacticSuperCheese Sep 17 '20
True, in my opinion, a good programmer has to be an expert at googling stuff
1
10
u/djh_van Sep 17 '20
So if you were applying for a python job tomorrow, what level would you apply for? A Junior, Mid-Level, or Senior Programmer? I'm not sure if you code professionally or just for fun. But I do wo set how much a python coder is expected to know all the constructs in their head, or just be able to understand how to make an algorithm and then just google the correct syntax to accomplish that goal.
3
Sep 18 '20 edited Sep 18 '20
Im curious about that as well. All my experience are in the VFX/Animation industry and getting some insight/experience into actual software dev/engineer job is somwething I highly desire. Ive taken some online algorithm and code interview courses and will need to heavily revisit them if I apply to such position.
Job posting around my area (Bangkok) for Python are almost always data science/engineer by the way while dev jobs are mostly web dev requiring dominantly C# or PHP backend
5
Sep 17 '20
i mostly use R at work (it at least seems like Python is better for how I use it, which is why I want to learn it), and this is how I feel about using it. Copy and paste with StackOverflow are most of my scripting process
4
u/Kbotonline Sep 17 '20
I’m the same with SQL. Constantly googling how to do stuff, even though I’ve created my own db models and all that. But then I’ll forget how to return records from the past hour or something and off I go googling again. The worst is when you can’t remember the name of a function, like it’s on the tip of your tongue and you’re googling all kinds of terms to try to figure out how to use it.
4
u/ladystardustxxx Sep 17 '20 edited Sep 18 '20
I was given a tip by one of my lecturers. If you have a good solution for something that you won't use often, or you find yourself googling something a few times, to keep a notebook with it. Be it a physical or just a .txt file. It's been a great time saver for uni.
2
u/Kbotonline Sep 18 '20
That’s what I have. I have different repositories with all kinds of scripts sorted by type and function. I’ve powershell, cmd, python and sql repositories with examples various things. Still though, it’s always the simple things I forget.
2
u/frex4 Sep 18 '20
Maybe do yourself a cheatsheet?
I'm having trouble learning git command and flow, so I made my own cheatsheet for git. Printed it out, just taped it to my workspace. Helped me a lot :).
4
u/mywan Sep 17 '20
I'm the same way. For me it doesn't matter which language it is, or even whether I've used that language before. I don't even remember basic built in command names. The first time I ever looked at shell code I wrote a config file parser the same day, and implemented a configurable file type handler from that. Once I have a clear language neutral model of what I want in my head it's simply a matter of identifying the features of the language needed to accomplish it.
3
u/uberdavis Sep 17 '20
I’ve been coding twenty years and I still review my framework and revise the code. You never stop learning and finding better ways to do things.
1
u/alphadist Sep 17 '20
Wow is it the same for all libraries or only a few?
1
Sep 18 '20 edited Sep 18 '20
There are a few I use more regularly than others that I can code without looking up as much. PyQt/PySide is 1 of them.
1
41
u/AngelOfLight Sep 17 '20
There is more to a language than simply getting familiar with the syntax. Most languages come with an ecosystem that involves tools and libraries. Python is one of the more well-supplied in this area. There are modules for just about anything you can imagine - some of the more well known are pandas (dataframe operations), numpy (numerical and array operations) Spark (parallel dataframes, distributed map/reduce functions), SQLAlchemy (RDBMS operations). This is in addition to base libraries that you should be familiar with, like collections and requests.
Python's base syntax allows for some elegant syntax that can greatly simplify your code. List comprehension and map/reduce, for example, can accomplish some highly complex operations in a handful of lines of code. Ditto for generators and decorators.
So, the actual syntax is just one part of the story. You can learn nearly all of Python's syntax in a fairly short amount of time. Its true power lies in combining the constructs so as to produce clean and simple code that can still accomplish far more than the equivalent, probably highly verbose code in other languages.
5
u/tek314159 Sep 17 '20
I think this is a big point. Python has so many libraries available that being familiar with what's out there goes a long way towards making you a more efficient and productive programmer. Don't need to reinvent the wheel and you can integrate all sorts of solutions to do what you want. When I started python, I had some trouble imagining exactly what I could do with it. But since then, I've played around with pandas, flask, pillow, sqlalchemy, and more to do lots of stuff I wouldn't have thought so easily achievable from core functions.
In that way it still harkens to its roots as a simple scripting language - a way to tie together lots of tools quickly and produce results in minimum time.
7
12
Sep 17 '20
A lot of time, the basics (the loops, the arrays, the try/catch if/else statements) is where the meat of a program works. Much of the rest is fluff to make it more user friendly.
I'd place myself at a hobbyist level. My biggest fault when it comes to programming, is never really knowing where to start. If I want to make something, usually it's already up on Github and I just need to modify it to suit my needs. But this is also important because whilst I'm not writing my own code, I'm still capable of understanding someones code well enough to know what I need to change/add/remove to function to what I want.
This is where the imposter syndrome comes into play. You'll see guys who started coding on a C64 in Basic. And they still feel like they know nothing.
Programming(And hell lets just tack all of IT into that) isn't so much knowing every library, syntax marking, service call there is. (Because that's a friggin' LOT and impossible to know everything) but it's about being able to understand what you need to make something work the way you want, and how to implement it. Referencing my Github comment above, it's about knowing what I need to change, add, or remove to make it function how I want it to function and when I don't know, do I know where to look and understand what I am looking at when I find a solution?
You'll get some hardcore fanatics that go "Just write it all yourself" and others (from what I've seen the vast majority) "Don't reinvent the wheel" and you'll always have this.
1
6
u/Yojihito Sep 17 '20
After the basics come the frameworks.
You don't "just" code, you do projects/tasks which require specific stuff which require specific frameworks.
E.g. for Python:
Webframework: Django
ML: Scikitlearn
Tabular data: pandas
Math calcs: numpy
And so on.
4
u/thrallsius Sep 17 '20
Where do you draw the line between the basics and past the basics?
Just treat the process continuously.
3
u/joelwallis1 Sep 17 '20 edited Sep 21 '20
You can get to the moon. Whenever you dive into advanced concepts of software engineering you realize all these tools, techniques, paradigms, etc., are created to make the life of a developer easier. It's true your software can get more mature, resilient, performance, etc., if you're using the right tools/languages/paradigms/techniques to solve the problem at hand, but there's nothing stopping you from doing things on "bare hands" (aka. using rudimentary language constructs like variables, functions, and some other basic language constructs).
This is also a recommendation: get good with the basics and you'll get over the advanced stuff quickly. They are just clever ways to use and manipulate the basic stuff.
3
u/veeeerain Sep 17 '20
You will have to just learn the short cuts that come with any new language, and the capabilities it has. For example python you will see that a lot of functions that are there are almost similar to some in js, but you may be able to do things in python that were better than js. Such as machine learning and data science. Honestly the foundational stuff will always stuck with you b you will always need to just adjust to syntax.
3
u/jerryelectron Sep 17 '20
Different languages have their strengths. So it's not all the same.
Fir example, classic for loops are probably one of the last things you should use in python.
3
u/01123581321AhFuckIt Sep 17 '20
Honestly with python you can get away with a lot knowing the basics. I consider Automate the Boring Stuff very basic but you can accomplish so much with just the knowledge learned there.
3
Sep 17 '20
A program gives you a result. A good one gives you the correct one. A great one does so quickly and efficiently.
A higher level language like Python is obfuscating the basics, which is why a language like python is approachable and easy to learn. Which I guess is ironic, because what you might think of as the advanced stuff, is really the basic stuff. The advanced stuff is what gets you to the efficiency.
So, I'd wager you haven't even scratched the surface, but that really depends on what you're trying to accomplish.
3
u/throwaway0891245 Sep 17 '20
Imo, in general the basics of any programming language is the same. However, there are key concepts that different programming languages focus on that aren't found in other programming languages.
For example, some languages focus on exposing relatively low level concepts in computing, like memory management and syscalls (e.g. C). Some languages are really as direct to the hardware as you can really go (assembly). But the concepts are not necessarily just how abstracted the computer is. The concepts may be abstractions themselves. For example, languages like Swift have the abstraction of optionals which is supposed to help you avoid issues with nulls. Some languages are more geared towards functional programming and all of its constructs, like Haskell. Types is another one, the abstraction of a data type and a language's requirement for explicit types is optimized for developing on large codebases. Rust provides an abstraction of memory ownership, which is supposed to help with concurrency and security. Go has the concept of vendoring dependencies. Underneath the language, the implementations and the way these languages work also differ and have consequences in terms of performance and optimization.
I think that expertise in a language has to do with being able to code in its idioms and knowing the standard library well, as well as specific details regarding the language implementation. The idea is that if you're really good at a language, then you can quickly make elegant and efficient code by using the idioms of the language in a way that you can create optimized code - not necessarily optimized for performance, but optimized for whatever you need it to do like being easily understandable, maintainable, extensible. In terms of performance optimization, it is probably knowing the language on a deep enough level to understand how the abstractions connect to the hardware and applying that information appropriately.
But ultimately, I think you can go far knowing just the basics because it seems to me that a lot of times, a lot of problems that you run into aren't even necessarily about the language so much as it is about some deeper issue that may not even be related to something related to technology. Of course, programming is a tool and its applications are wide and diverse. I'm sure you'd have to know very much about hardware and programming languages for something like being a compiler developer, or a language designer, or someone that develops highly optimized libraries in a low level language.
5
u/softwarethrowf Sep 17 '20
Remember that programming is not the same as coding, and computer science is not the same as programming
2
0
Sep 17 '20
[deleted]
1
u/artificial_neuron Sep 17 '20
Programming is part of CS but it's entirety.
I'm not sure why think programming and coding is different. I wonder if it's down to perception or if they consider coding to be writing a script and programming as writing a program.
1
u/RoosterBrewster Sep 17 '20
Maybe he means a programmer is a software developer. Similar to how an engineer is not the same as a drafter.
1
u/softwarethrowf Sep 18 '20
Well CS isn't necessarily knowing the best algorithm its more the theory behind the algorithm and why it works and how to make algorithms, coding is literally writing code with no kind of mathematical logic like front-end web development and programming is solving problems using code, turning an input into a solution.
2
u/badjano Sep 17 '20
Everything in programming is just file reading, serialization and networking, understand these 3 things and you can do a lot of stuff
2
u/TazDingoYes Sep 17 '20
Personally I feel like knowing the basics has helped me understand most languages I've tried to pick up on a surface level... But for me that creates the problem of getting bored easily because a lot of courses don't go into how to implement those things in a meaningful way. I did a whole JS course and by the end knew what I felt was enough to get a basic job in it if I wanted to, but at no point did the course teach me how to implement JS into a website, so ultimately it was useless. It seems like a lot of online places are like this, Unity, C#, and Python were ones I had the same issue with, it's like, cool you wrote out what an array looks like but how would I use this in context with other bits of code or inside a useful program/app.
Maybe I'm just really specific about how I learn, but I just hit a wall after a point because I feel like the fundamentals don't change all that much between languages and there's only so many times I can tolerate a beginner chapter on "this is an if statement" and "here's how to make a bunch of console based 'games' you will never use again"
2
Sep 17 '20
Learning the language's constructs is only the first step. Mastery of this stage is illustrated when you can be shown an arbitrary segment of code in that language, and you'd be able to identify what every operator, expression, statement, etc. means, as well as what the entire segment does as a whole. Using natural language as an example, it's like if I showed you a random sentence in English and had you define what each word in the sentence means, and state what the sentence as a whole is saying.
The next major step is learning algorithms and data structures. This is analogous to learning how to write a strong sentence in a natural language such as English, and understanding what makes that sentence strong (or weak). In programming terms, you'd want to learn the most common algorithms, algorithm paradigms (divide and conquer, greedy, DP, backtracking, etc.), data structures, and space-time complexity analysis. Mastery of this stage is being able to implement a solution to a computable problem, determine if your subroutine is optimal, and if not, what tradeoffs exist to improve it asymptotically.
The third major step is Design Patterns. Recycling the writing metaphor, this would be like learning how to write great paragraphs/stanzas. Design patterns are used to create software architectures in a methodical and commonly recognized way, just like written works such as poems, novels, and articles are often composed of paragraphs/stanzas. Mastery of this stage is illustrated when the developer can skim through a library/framework and identify the patterns that were used and why it made sense or didn't make sense to use those patterns.
This is what I call "building up" the language. There is also "building out" the language, which involves acquiring experience in the most popular frameworks and libraries of that language.
3
u/egehurturk Sep 17 '20
Python can be very very complicated and complex if you dug deeper. Asynchronous code (__aiter__), Metaclasses (class Test(type), class Subtest(metaclass=Test)), Higher order functions, and many more. If you want to master and become a true pythonista, you can read Fluent Python
1
u/Flynni123 Sep 17 '20
With python you can learn things like everything: From algorithms to artificial intelligence. From easy apps to complex guis. From a webapp to a complete html Server.
So its a wide range and nobody can say how hard one thing is 🤷♂️
1
u/Herodegon Sep 17 '20
Learning programming is relative. There's a near-endless quantity of material on the general subject, increased exponentially by all the nuances each language adds.
Instead of seeing it as steps forward through the basics, look at it instead as an infinite learning experience that could see you using the same tools in ways you never though of before.
1
1
Sep 18 '20
Beyond the basics what makes you intermediate in a language is knowing the libraries, so you can solve problems faster and easier than from scratch
1
Sep 18 '20
You should be able to get yourself solving problems at the first place. Try to create a thing based on an idea and in order to do that, try to break things into smaller parts and solve the smaller ones first.
0
u/Chris_Hemsworth Sep 17 '20
Coding is literally like learning a language. Imagine the difference between English, Spanish, and French. There are lots of similarities, but they have a focus on different aspects. French and Spanish rely much more on the differences between masculine/feminine words, as well as bring a lot of emotion in to convey concepts in a slightly different way. There are some words that don't translate very well at all, and what you end up with is a 'rough translation'. That said, almost everything that needs to be communicated can be in some form or other.
Coding languages are the same. For example, in Python there is no 'case' statement (yet), but there is in other languages! You can get around it by using dictionaries and their get() command, but that is one of those 'rough translations'.
Some languages are designed around solving a specific problem. MATLAB for example was designed for data science and to make things intuitive for scientists, but you'd be crazy if you said you wanted to create a web application purely in MATLAB. It can probably be done, but its just not efficient and would require lots of work.
1
u/jabpoke Sep 19 '20
It is a good metaphor.
There could be a concept that is a standard notion in one language but requires much more explanation in another. (In French, someone might respond to the question, "did you get up early?" with a single word: "trop". Way too early. Maybe it comes with a groan. Or did you eat too much at dinner? again, "trop", meaning "way too much." And so on. But in English, it's more words for the same thing. You see the same word in Italian - when the musician sees a marking on music that reads "allegro" it means fairly fast, but "allegro non troppo" means, "but don't go overboard.")
Programming languages have that. Some languages think in matrix operations and make them easy - MATLAB, APL. Otherwise try to do business logic using plain-english: COBOL's claim to fame was that.
In fact, the inventor of COBOL (Grace Murray Hopper) repeated - constantly - that we needed different programming languages. The specialist in meteorology might need to write out his/her programs differently than the person writing interest computations for a credit card account.
1
u/redfacedquark Sep 17 '20
If we're comparing verbal languages with computer languages I can't help but think that (British) English would be the PHP of the world. Too much broken, legacy artifacts to be a useful reference language going forward but currently annoyingly pervasive.
0
182
u/queen_debugger Sep 17 '20
Watch this bad boy. James Powell: What Does It Take To Be An Expert At Python