How does adding comments affect the memory usage? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How does adding comments affect the memory usage?

Is it recommended to not comment heavily on the code?

26th Aug 2016, 10:06 PM
Sanchay Cholkar
Sanchay Cholkar - avatar
5 Answers
+ 4
comments are for people, programs ignore them. they don't really increase memory usage - they exist only on hard drive (in text file with script), but not in RAM, where programs are running you can use as much comments as it needs to explain your code - either to yourself or to someone else. and commenting your code IS recommended, especially in more complex projects
26th Aug 2016, 10:14 PM
Demeth
Demeth - avatar
0
I did not know that
28th Aug 2016, 2:04 AM
Andrea Zander
Andrea Zander - avatar
0
would not it be true if the program was compiled? I mean Python code is interpreted, the file is indeed read line by line so it is loaded into the RAM memory. Right?
31st Aug 2016, 2:23 AM
Cesar Lopez
Cesar Lopez - avatar
0
I think that when the program is compiled the compiler hits the pound symbol and ignores everything after it so it wouldn't be in the ram
2nd Sep 2016, 5:56 PM
Eric
0
I think that the compiler utilize the RAM to storage this.
14th Sep 2016, 4:26 PM
Bruna Katiele
Bruna Katiele - avatar