r/learnpython • u/world_of_delusion • Dec 24 '23
Memorizing syntax
Hello, I am new to Python and programming in general. I am learning Python on EdX, and was wondering how important it is to memorize syntax for different functions like find, replace, convert to upper/lower case, etc. Wouldn't memorizing them be redundant since they can be Chatgpted?
19
u/Equal_Wish2682 Dec 24 '23
You don't need to memorize all the syntax. You absolutely need to know how to Google it.
You're wasting your time if you think GPT has solved programming.
1
u/supanatral Dec 24 '23
ChatGPT hasn’t solved programming but it’s done a dang good job at teaching me Python and has helped me solve problems. Best of all, I use ChatGPT less and less each day.
Even when I ask it questions, it’s far from perfect and needs debugging but so would Google.
That’s just my two cents
1
u/Equal_Wish2682 Dec 25 '23
it’s done a dang good job at teaching me Python
Says who?
1
u/supanatral Dec 25 '23
Says me. It taught me a lot about Python as I asked it questions on how to do something. I use it less and less each day as I’ve learned
1
u/Equal_Wish2682 Dec 25 '23
You can't possibly know that. In fact, all you can say is you know more than you did. You have no benchmark, and you don't know what you don't know.
1
u/supanatral Dec 25 '23
Seriously bro?!
Someone has come on this sub who has learned enough to become independent for the most part and the most you can focus on is how much I don’t know? 🤦
Of course there’s a mountain for me to learn still. All I’m saying is that ChatGPT was a great tool
1
u/Equal_Wish2682 Dec 25 '23
A novice cannot assess progress.
That is a statement of fact.
1
u/supanatral Dec 25 '23
Thanks for the encouragement!
With positivity like that, who needs motivational speakers?
1
u/Equal_Wish2682 Dec 25 '23
I'm not trying to discourage you.
Understanding the rules of any game, should make you a better player.
1
u/supanatral Dec 25 '23
And what I’m saying is: when someone is excited about how far they’ve come and as fast as they have…..saying anything along the lines of “you know nothing and only people like me can judge that” is not constructive nor helpful in any way
→ More replies (0)-4
8
u/Adrewmc Dec 24 '23 edited Dec 24 '23
Most of this is actually in the Python documentation, a lot of IDE have a hover over that will bring up the docstring and tell you the syntax. This is also more accurate than ChatGPT.
You don’t need to memorize it. If you end up using it regularly…you’ll memorize it anyway.
I wouldn’t necessarily call this Syntax though, but parameters of built in functions/methods. There is certainly some syntax that will just have be memorized but the same can be said of anything that takes some skill.
1
u/world_of_delusion Dec 24 '23
gotcha thanks a lot! also wdym by IDE?
2
u/Adrewmc Dec 24 '23 edited Dec 24 '23
It technically stands for Integrated Development Environment, but it’s basically the program that you code in VsCode is an IDE, PyCharm is an IDE, (these are the top two Python IDEs I believe) and there are various other sometimes schools force a particular one on you. (Technically someone is gonna argue notepad is an IDE at some levels)
1
1
2
u/notacanuckskibum Dec 24 '23
Integrated Development Environment. I use Visual Studio though Python purists seem to dislike it. It is like an extended text editor that includes knowing the names of variables and functions and suggesting the possible choices at any moment. But also an interactive debugger.
3
u/FriendlyRussian666 Dec 24 '23
Anything that you can easily Google in 10 seconds, don't memorize. Just understand the concept and know that it exists in case you need it, don't worry about remembering how to implement it.
1
6
u/GuaranteeKey3853 Dec 24 '23
IMO unless you have nurallink the bandwidth of ChatGPT to brain compared to just brain to brain is worth learning syntax
4
u/zanfar Dec 24 '23
This is the worst possible use for ChatGPT.
Remember: ChatGTP makes all of it's answers up. Sometimes, what it uses to make those answers up is correct, but there is nothing in ChatGTP that ensures, or even attempts, to make answers correct--just familiar.
Therefore, while LLMs like ChatGPT can be very useful, they should be predominantly used when you can understand and validate the answer. That is, asking ChatGPT to write a block of code is fine as long as you can read that block of code and see that it meets your needs. However, asking ChatGTP "how do I use replace() is problematic because you won't be able to know if the answer is correct.
For instance, if you ask ChatGPT the right way "how to loop through an array", there are enough incorrect answers on the Internet that it will have learned the wrong answer and will give it to you.
If you need to lookup syntax, the correct resource is the Python documentation. That is the only resource that can be said to be 100% accurate.
2
u/Aleatoire Dec 24 '23
Don't memorize. Because you would be storing this data in the wrong part of your brain.
But don't also rely entirely on Chatgpt. You'd be at a disadvantage compared to people that didn't when they first learned.
If I had to do it all over again, I would pick myself a simple existing project (100 to 1k LOC), try to reimplement it the best I can, and have Chatgpt to review my code.
2
u/CptBadAss2016 Dec 24 '23
Yeah, while amazing chatgpt it is still "dumb". It is a powerful tool to leverage but the programmer has to manage it and proofread everything. Rarely have I had it produce an algorithm that didn't need at least some tweaking. And sometimes it will churn out complete garbage, you'll tell it why its garbage and how to fix it, and it'll try again and churn out the exact same garbage with zero changes. (This is what I mean by "dumb") it's not actually producing code it understands, it's mixing and mashing frankenstein code from other pieces of random code it trained on on the interwebs... And who knows if that bit of code it's reproducing for you now was any good in the first place.
0
u/Equal_Wish2682 Dec 24 '23
In order to determine the veracity of its response, you must thoroughly understand the subject matter.
If you thoroughly understand the subject matter, there is no point in asking it a question.
Therefore, it has no valid use case.
1
1
Dec 24 '23 edited Dec 24 '23
[removed] — view removed comment
1
u/Equal_Wish2682 Dec 25 '23
That's a pretty wild blanket statement, it's super useful as long as you can verify the output.
Making it fundamentally unsuitable for its question-answer form factor.
1
Dec 25 '23
[removed] — view removed comment
1
u/Equal_Wish2682 Dec 25 '23
I'm not gonna waste time figuring out the odds and ends of a specific python module if I can just ask gpt what method I might need to achieve xyz, and do my own research from there.
This is where we differ.
I don't view understanding as a waste of time.
2
u/Buttleston Dec 24 '23
You need to know what is available/possible, and you need to know where/how to find more information. There are some things you'll use so often that you won't ever even need to think about the syntax and some things you use so infrequently that you'll need to look it up every time.
I have also found that working with other people/having other people review my code means that I both get to show people things they weren't aware of and learn things I wasn't aware of.
The core language of python is not very large, it's feasible to know everything in it (by core here I mean, what you get from python without importing anything - strings, lists, dicts, loops, etc). Then there's a first tier of libraries you'll use all the time most likely - time, datetime, logging, os, math, sys. The exact list of what you think of as the first tier will kinda depend on the kind of programming you do, but you'll use those libraries a lot and will probably know what's in them and what kind of parameters they take.
Then there will be sort of second tier and beyond and you'll be vaguely familiar with what's in them, and when you start to use one more for a while you'll dig in and find new stuff and incorporate it.
It's the same thing with real life. I know how to cook eggs without needing to look it up. I could make an omelette by spending 5 minutes on youtube checking some things. I'd need to do a little research to make eggs benedict but I generally know what the ingredients and techniques involved are.
1
u/Bobbias Dec 24 '23
This is the correct answer.
You shouldn't be going out of your way to explicitly memorize things, but understanding what's available, and internalizing the most common things you use is important.
Those things come with time, and with (hopefully) reading the official documentation.
And about ChatGPT:
ChatGPT is not reliable, and often simply makes up answers that are completely wrong. It has no way of knowing what it is wrong, and should never be trusted. New programmers should forget that ChatGPT exists, because you need to be experienced enough to know when ChatGPT is wrong about something in order to use it in a safe and productive manner.
2
u/Unitnuity Dec 24 '23
So I'm pretty new too. And I used python and chatgpt to help me with a browser-based game I was playing and even asked it, was it worth it to learn python if I could just ask chat everything. It gave me a decent answer but it was the other day that I saw something that made sense.
It was along the lines of my question "why would I learn to code if I can just ask ai?". And the response was "so you can code the ai that replaces the programmer who replaces the ai" and so on. We make the ai, the ai doesnt make us. At least for right now lol
1
1
u/baubleglue Dec 24 '23
Try to execute help("memorizing".find), if you are using Jupyter or ipython consoles ?"memorizing".find
1
u/my_password_is______ Dec 24 '23
Wouldn't memorizing them be redundant since they can be Chatgpted?
I plan on moving to Italy
why learn Italian when I can just use a translator on my phone
that's you
1
u/MezzoScettico Dec 24 '23
I've seen an ad for some translator app depicting exactly that, everybody wandering around using the app to communicate as the native speakers smile happily.
1
u/Logicalist Dec 24 '23
That's all find and dandy if you don't mind taking a lot longer to do something.
Memorization just makes you so much faster and useful. It allows your brain to do more work faster, since the information is available to it. Making programming easier.
Python has all of like what 80 builtin functions, maybe less than 10 built-in types. There is really no reason not to memorize those, most of them are useful.
Beyond that, a binder with your most used information is a worthy time investment. Because you're going to the same place to access the information. And can organize it in a way that suites you best.
Google and chatgpt especially, are useful for finding information to print and save.
1
u/Contrabaz Dec 24 '23 edited Dec 24 '23
Know the difference between data types. Learn and play around with methods. Know how a loop works, know the difference between a for and a while. Learn to use a text file, a CSV and an XML. Then play around with the contents, like reformat it and write to a new file.
It's about learning the toolkit, and learning to solve problems with said tools. Don't think about what to type, think about what you need to solve the problem.
Like if you make a calculator. You take an input, what do you do with that input so you can add or multiply it?
Or you parsed some numbers from a CSV and want to add them to a total number, but those numbers are a string with a comma as decimal separator instead of a period...can't convert that to a float or int..how can we fix that?
If you google something make sure you understand what you use in your code. Cutting and pasting strings of code you don't understand has the opposite effect. You'll get even more confused.
1
u/SamuliK96 Dec 25 '23
Chatgpt can be very useful for getting code snippets and formulating an idea or a concept into code, but for understanding the syntax etc for functions Google and the Python documentation are your best bets.
I'd also say that you shouldn't really worry about actively memorising stuff, but instead just keep coding and you'll likely start simply remembering how things work without noticing it at first.
26
u/ogabrielsantos_ Dec 24 '23
Learn how to solve problems. Picking the right function will be natural after this. Easily you can search for them when you know what you are trying to solve.
disclaimer: I’m a 12+ year developer who daily search for function names.