Re:Python has brought computer programming to a vast new aud...
by eesmith on Saturday July 21, 2018 @04:29PM
(#17583705)
You wrote "These are all extremely helpful".
I disagree, in that I think they are only somewhat helpful. If we only had double-quoted strings, and not single-quoted strings, then I think there would be little difference to the language or its quality of use.
Going back to the question of "why st_mtime?" - that's because os.stat() is a wrapper around the POSIX stat(2) system call. My FreeBSD man page defines it as:
st_mtim Time when file data last modified. Changed by the mkdir(2),
mkfifo(2), mknod(2), utimes(2), write(2) and writev(2) sys-
tem calls.
The Python implementation of stat for MS Windows is basically doing its own emulation layer for POSIX compatibility.
These are all extremely helpful, though. All of those quote combinations are equivalent, and can be used to prevent having to escape quotes within the string. The u prefix is gone from Python 3, r is a raw string (which many other languages have, like C#'s @ prefix), and f is a new feature which generated a lot of debate but basically allows interpolation similar to Ruby and ES6.
>The one I have in mind is the os library, which I use a lot (like why st_mtime?).
That's the one I thought you were going to bring up. I agree the naming conventions in the os module have a lot of warts. The function names could use a refresh.