Dec-01-2017, 02:59 PM
(This post was last modified: Dec-01-2017, 02:59 PM by QueenSvetlana.)
(Dec-01-2017, 02:40 PM)snippsat Wrote: Try to avoid global variables
at all cost,is a good rule.
The way I've declared
file_name
and files_to_backup
are not in a global
way, correct? The problem is these two variables might be used else where in my script, keeping them hidden inside a function will make it more difficult to use. You could return a dictionary of items, but it seems unnecessarily complicated. This python script could as easily have been a bash/powershell script, and in those you don't worry about variable scope. The only way to hide a variable is inside a function.