title: Copying a list of paths/files to a directory
body: <p>I'm just doing an exercise where I have a list of files (given as absolute paths), which should be copied to a given directory if some sort of flag is set. This is my function to copy the files:</p>
  
  <pre><code>def copy_to(paths, dst):
    if not os.path.exists(dst):
      os.makedirs(dst)
  
    for path in paths:
      shutil.copy(path, dst)
  </code></pre>
  
  <p>However, the given solution looks different:</p>
  
  <pre><code>def copy_to(paths, dst):
    if not os.path.exists(dst):
      os.makedirs(dst)
  
    for path in paths:
      basename = os.path.basename(path)     
      shutil.copy(path, os.path.join(dst, basename))
  </code></pre>
  
  <p>Is getting the basename of the path and joining it with the path where to copy to really needed here?</p>