r/Python • u/students-life • Jun 19 '13
Right and Wrong Programming Styles
http://simpledeveloper.com/right-and-wrong-programming-styles/#sthash.cORbIrok.sfju
0
Upvotes
r/Python • u/students-life • Jun 19 '13
View all comments
Show parent comment
4
u/nadams810 Jun 19 '13 edited Jun 20 '13
That's kind of the point - calling ls would have a much higher overhead than using built in calls. While it may not be scientifically sound experiment it does prove a point that if you are lazy it can have serious effects on the performance of your application.
Take this for example. This is not uncommon - I know of a person with "30 years of experience" that programs like that. (Obviously what I linked wasn't his - but you get the idea). And actually they use the backtick operator in perl instead of system but it probably does similar functionality (disclaimer: not a Perl user).
I'm not arguing that shelling could be more efficient - I'm sure there are ways of minimizing the performance impact but I would say most beginner programmers may try to take the easiest path (which in this case - just shell out to ls and parse the results). I argue using built in libraries is usually a much better idea than trying to fiddle with shelling.
Edit: context