On Fri, Dec 29, 2017 at 7:19 PM, Zac Medico <zmed...@gentoo.org> wrote: > +def _set_timestamps(source_stat, dest): > + """Apply timestamps from source_stat to dest. > + > + Args: > + source_stat: stat result for the source file. > + dest: path to the dest file. > + """ > + os.utime(dest, (source_stat.st_atime, source_stat.st_mtime)) > + > + > +if sys.version_info >= (3, 3): > + def _set_timestamps_ns(source_stat, dest): > + os.utime(dest, ns=(source_stat.st_atime_ns, > source_stat.st_mtime_ns)) > + > + _set_timestamps_ns.__doc__ = _set_timestamps.__doc__ > + _set_timestamps = _set_timestamps_ns > + > +
This seems weirdly complex. I guess the goal was to reduce the sys.version_info check to once per import? The __doc__ trick is nifty, but I'm not sure I would ever want to use it myself. Anyway, just my thoughts as an unpracticed python programmer. It looks like this code will get the job done.