On Thu, Jul 18, 2019 at 8:53 AM Christopher Barker
But I've always (which goes back to Python 1.5) thought that putting platform-specific behaviour in standard modules was a wart. My prime example is the os module -- it is a wrapper around platform specific modules, and most of it provided platform-nuetral features, but a there are a few oddballs in there.
Why do I care? because folks can write code on a posix system, and have no idea that that code won't work on, e.g. Windows. It wouldn't seem such a burden to do:
import os and then, when you posix only features -- import posix
Making it very clear that that particular part of the code will only run under posix.
That might work if it's entire functions that have different behaviour. What about these features? https://docs.python.org/3/library/os.html#files-and-directories And what if support changes? https://docs.python.org/3/library/os.html#os.link Would there be posix.link() and windows.link() with identical signatures, with the latter being "only since 3.2"? Or would "posix + windows" be considered universal enough to put it into the os module? And what about os.stat(fn).st_ctime ? ChrisA