+ 1

can someone kindly correct me if i am wrong about this quote "As the program contains multiple lines of code, you should create it as a separate file and run it." does that mean that if my code gets bigger it is advisable to create less line of codes but many files?

23rd Jul 2016, 2:13 AM
joel bonita
joel bonita - avatar
4 Answers
+ 3
You are absolutely right! It's a good practice to limit the size of a source file. If your source file is too big, it will be difficult to understand and you should segment it more. But I think the most important is to have short function (when I started learning programming, it was told not to exceed one screen page for a function, in order to be understood without scrolling). Of course, if you have to many functions in a file you may segment it in different files. OOP will help you to do this because you can make class and group coherent function.
24th Jul 2016, 1:49 AM
samuel delepoulle
samuel delepoulle - avatar
+ 2
I guess it all comes down to coding style and preference if you prefer larger files or calling multiple files... but to answer your question on the text above; it just means that you will get better results from calling the python script from the interpreter rather than just using the online console to test your code.
23rd Jul 2016, 2:41 AM
Frédéric Charette
Frédéric Charette - avatar
+ 1
thanks pal
23rd Jul 2016, 2:44 AM
joel bonita
joel bonita - avatar
0
you're welcome !
23rd Jul 2016, 2:47 AM
Frédéric Charette
Frédéric Charette - avatar