This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Rename the posix module to _os
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, r.david.murray
Priority: low Keywords:

Created on 2016-05-12 19:16 by brett.cannon, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg265421 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-05-12 19:16
It's always bugged me that the posix module changes its name based on what OS you're running under. I think it would be better to name the module _os as that it's consistent. We can alias the name to posix/nt for backwards compatibility (and even do this in importlib since it uses the module, so no worries of missing the aliasing). It also helps reinforce the note at the top of the posix module that it shouldn't be imported directly.
msg265422 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-05-12 20:04
I know you know this, but to be clear for other readers, the module naming happens at compile time, not runtime.

If you alias the module, it's __name__ will still be '_os', won't it?  Might that not have backward compatibility issues?  And if you also change that, then what's the point of not having it use an os specific name?
msg265423 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-05-12 20:08
You're correct that it could break code checking the module's __name__ value if that was changed.

As for why I care, it sucks trying to import this module for any reason. Any place you touch this module you have to proper try/except ImportError checks to work around its multiple names. I just personally think it's a bit silly to have to do that.

Anyway, there's a reason why I marked this a low priority. :)
History
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71199
2016-05-26 20:23:02ppperrysetversions: + Python 3.6
2016-05-12 20:08:28brett.cannonsetmessages: + msg265423
2016-05-12 20:04:40r.david.murraysetnosy: + r.david.murray
messages: + msg265422
2016-05-12 19:16:46brett.cannoncreate