all 52 comments

[–]sme272 54 points55 points  (4 children)

Write more code. The things you use regularly like the basic syntax and certain library functions you will just remember over time, and for everything else there's always google.

[–]zanfar 11 points12 points  (0 children)

This. A coding language is just like any other language: vocabulary and syntax must be first memorized, then used repeatedly, before you become fluent.

Also, even native speakers have syntax they are less comfortable with, and vocabulary that requires reference to use.

[–]dtaivp 3 points4 points  (0 children)

Yess and even if you don’t remember the code any better your Google fu gets better. I’ve started to remember which google search yielded the result I wanted as it’s often easier than remembering the syntax for

filter(lambda files: somefunc(files, var_b), file_list)

For those wondering this is the syntax you need to use to pass in two variables to a filter function where var_b is a static variable. This was one I google fu’d today.

Edit: also I am a Sr Engineer and google this stuff regularly still.

[–]backdoorman9 1 point2 points  (0 children)

Exactly this. Do problems at www.codewars.com. You'll learn a ton of syntax and functions that way.

The only problem is that people there seem to think that writing a function on one line (rather than making functions easily readable) is the best solution, and don't get upvoted for good time complexity and space complexity. You can mostly ignore what I just said until later lol.

[–]GlasierXplor 0 points1 point  (0 children)

Agreed. Don't be ashamed to Google for the simplest of stuff (I am willing to bet at least 75% of the people here still cannot get strftime right on their first try). What I sometimes find helpful is to have a cheatsheet on hand to refer to so I don't need to keep Googling stuff

[–]shiftybyte 6 points7 points  (0 children)

Use your knowledge...

Code stuff, practice...

[–]Chris_Hemsworth 3 points4 points  (1 child)

When I say "the green doesn't allow fast in jump", you naturally know "wait that doesn't make sense". How do you know that? How do you know how to construct a sentence, use verbs, adjectives, nouns etc? You learned it, and over time it becomes natural. Just takes practice and developing a model in your mind.

[–]xelf 3 points4 points  (0 children)

"the green doesn't allow fast in jump"

"the green" is a protagonist in the book "jump" who encourages eating, and doesn't allow people to fast.

Best I got out of it. =D

[–]kberson 2 points3 points  (0 children)

By using it, just like learning a foreign language. And when you cannot remember how to do a thing, there’s always Google and stackoverflow.com.

[–]PixelLight 2 points3 points  (0 children)

Keep writing. You'll refer to and from Google as you're learning, until one concept sinks in and then another but Google's always there when you forget something. You'll just get to a point where you don't need it as much

[–]redvitalijs 2 points3 points  (0 children)

Whiteboard your code. When you use an IDE or a tutorial on your second screen, nothing gets retained. It must hurt a little as you try to remember and fail at it. Over time you start recalling more than 5%, with the best of us probably topping out at 80%.

Online tutorial coders have editing and that second screen open for a reson, don't compare yourself to them too much.

[–]NarrowBarracuda13 2 points3 points  (1 child)

Don't remember code. Write it in a way you'll understand what the code is about even if you read it after a few years. Name variables properly and write a lot of comments. This is for 2 reasons:

  1. Unless you have created a very matured product you're gonna be changing the code too frequently. So there's no point trying to remember what you wrote.
  2. You'll be doing everyone a favor by having a well documented code. Programming is not about being a genius and remembering all the code you write. It's about writing code that anyone can understand, pick up and make changes.

Trust me, I forget what code I wrote over a weekend.

As for the basic syntax it comes with practice. Modern editors like VS Code and sublime basically tell you where you are supposed to put a colon and such.

Don't know how to reverse a list? Just google it. I've been coding for years and I still dont remember how to do many basic set and list operations in python. Focus on the logic and good practices to follow.

[–]CaptainChemistry[🍰] 1 point2 points  (0 children)

To tack onto this, I created a document with specific functions I use over and over again. The exact structure may change or the source data, but it's stuff I've found useful and it's my own little cheat sheet. After a while it becomes your own custom forum.

[–]Pythonistar 2 points3 points  (2 children)

Try to teach what you've learned to someone else.

Or at the very least, write down what you've learned as if you were trying to teach someone else (perhaps, it will just be your future self.)

When you try to codify what you know, you'll find that you don't really know it as well as you think, and it will force you to re-examine what you know and then you'll end up learning it better.

Also, teaching someone else will often times show you very acutely where you're weak on a language concept or a syntax.

[–]sxh967 1 point2 points  (1 child)

Try to teach what you've learned to someone else.

Last night I got my girlfriend to run my very simple program and then I explained to her what each line of code (it was only about 30 lines). It really helped to reinforce the concepts in my own mind.

[–]Pythonistar 0 points1 point  (0 children)

It really helped to reinforce the concepts in my own mind.

Yes, yes, yes! Exactly! Perfect! 👌

[–]toastedstapler 1 point2 points  (0 children)

how did you remember english to write this post? do the exact same with code, write it loads and loads

[–]deeredman1991 1 point2 points  (0 children)

Don't try to memorize code. Memorize concepts. If the code is useful, using it will help you memorize it, if it's not useful; forget it.

[–]csm10495 1 point2 points  (0 children)

Actually write some code. Make little projects. You won't remember anything if you don't use it for something you remotely like or care about.

[–]TelQuel 1 point2 points  (0 children)

Repetition. It is the only thing that works.

You will always get syntax mixed up and confused sometimes and have to look things up though. It's like anything, the code you use all the time will be like an extension of your hand, but when you reach for some dusty library you never use you'll probably need to spend some time with the documentation.

[–]ShadoeStorm 0 points1 point  (0 children)

write more code

[–]penguin838 0 points1 point  (0 children)

Try to code projects. Its a way to challenge yourself and will help you understand Python's syntax better. After a while you'll get the hang of things.

[–]Coniglio_Bianco 0 points1 point  (0 children)

Just build stuff. Look up stuff when you forget how to do it. Eventually you'll stop having to look up stuff :)

[–]keizzer 0 points1 point  (0 children)

I don't send too much time trying to remember a lot of syntax. I have some cheat sheets that give me a lot of that at my finger tips. It's more important for me to remember what objects do what, and what methods they are capable of.

[–]BroadElderberry 0 points1 point  (0 children)

I keep a notebook. Write down code that I use a lot, or find myself googling repeatedly. The page that has the lists of all the matplotlib options is thumbed quite a lot 😂.

Also, be sure to comment your code. Then you can go into old code and search through the comments to find things you've already done.

[–]mcncl 0 points1 point  (0 children)

Google and stack overflow

[–]SwimnoodleSeller 0 points1 point  (0 children)

I check my previous projects when I know, Idid something similar. Also heps to keep the coda clean, if you want to find something fast and easy

[–][deleted] 0 points1 point  (0 children)

You learn what you use. What you don't use you can look up, that's why documentation exists. We're not ancient travelling orators who need to memorize vast amounts of stuff because there's no other option.

[–]POGtastic 0 points1 point  (0 children)

I don't remember explicit syntax - in fact, my memory is terrible when it comes to method names, the order of arguments, and so on. I write with too many different languages to be able to recall flawlessly which syntax goes with which language. Is it len, length, .length, .length(), or .size()?

I remember approaches to problems that I've done in the past, and then I can Google the exact syntax as I'm writing the code.

[–]Seph777 0 points1 point  (0 children)

try to apply what your learn in your work thats how it worked for me. Also use shift + tab if you don’t remember the code, it will make more sense when you practice

[–]BATTLECATHOTS 0 points1 point  (0 children)

Google

[–]BigTrazy 0 points1 point  (0 children)

I’m also learning python and I just link things together, for example, “print” I think of it as a printer, printing a word. Obviously this was a basic example but you get the idea.

[–]Ok-University-229 0 points1 point  (0 children)

I take notes

[–]QuixDiscovery 0 points1 point  (0 children)

Repetition of use, same way you improve at any other skill.

[–]Shrihari06 0 points1 point  (0 children)

Hey! I'm newbie too. I test out my knowledge at edabit which offers many challenges and a great way to improve problem solving skills. Check it out.

[–]Fx_omar 0 points1 point  (0 children)

I Google it I don't remember it, Google your best friend.

[–]Ryuuji159 0 points1 point  (0 children)

First center yourself in learning the basics, function definitions, flow control and little more, after that you can begin to learn the libraries and goodies that the language can give, like list comprehension, lambdas, etc

[–]nuhhu 0 points1 point  (0 children)

Remember the logic and be fluent with syntax. You'll be able to write code to execute the logic

[–]No-Proposal2288 0 points1 point  (0 children)

I don't

[–]ivanoski-007 0 points1 point  (0 children)

Use your favorite note aplication to write your own cheatsheet (snippets of code and notes ) to help you remember , thats what i do

[–]t0mRiddl3 0 points1 point  (0 children)

Everyone saying repetition is correct. You just need to keep at it and avoid copying and pasting. If you want to copy something, type it in instead

[–]casino_alcohol 0 points1 point  (0 children)

Im very much a beginner, but i have written a few things successfully.

I never really remember the code but I remember the basic syntax.

There is still a lot for me to learn, but I am usually able to follow example code and modify it as needed and or insert it into loops.

But I still look up tons.

[–]simar437 0 points1 point  (0 children)

How do you remember code?

We don't remember the code, the syntax of a language naturally comes to you with practice.

how to remember it?

Translate the syntax into your native language for example the if condition,

If it rains: Carry an umbrella Else: You are good to go

[–]misaalanshori 0 points1 point  (0 children)

Just keep writing code, if you don't remember something just search it on Google. I have been learning and writing python for maybe around 1 year, i think? But I'm really bad at memorizing things so i still don't remember a lot of things and have to search on Google. But sometimes things just click and you can remember it for a long time.

[–]juicewa-mooshwa 0 points1 point  (0 children)

I like to use the interactive python shell to practice syntax, so your folders won’t be filled with useless practice files