[Python-Dev] Pathlib enhancments - method name only

Eric Snow ericsnowcurrently at gmail.com
Fri Apr 8 22:45:32 EDT 2016

On Fri, Apr 8, 2016 at 7:41 PM, Brett Cannon <brett at python.org> wrote:
> On Fri, Apr 8, 2016, 16:13 Glenn Linderman <v+python at g.nevcal.com> wrote:
>> On 4/8/2016 3:28 PM, Eric Snow wrote:
>> All this matters because it impacts the value returned from
>> __ospath__().  Should it return the string representation of the path
>> for the current OS or some standardized representation?  I'd expect
>> the former.  However, if that is the expectation then something like
>> pathlib.PureWindowsPath will give you the wrong thing if your current
>> OS is linux.  pathlib.PureWindowsPath.__ospath__() would have to fail
>> or first internally convert to pathlib.PurePosixPath?
>> Now that Windows 10++ will run Ubuntu apps, will Python be able to tell
>> the difference for when it should return Windows-format paths and
>> Posix-format paths?
> All the bits of code in Python accept / as a separator on Windows so it
> doesn't matter (but Ubuntu on Windows is Linux, so it will be / just like
> any other Linux install).

Technically it isn't linux. :)  It's the Ubuntu user-space using the
linux syscalls (like normal), and those syscalls are implemented as
light wrappers around the Windows kernel.  They even implemented fork.
On Windows.  There's no linux kernel involved.

>> (I'm sure the answer is yes, the Python-for-Ubuntu running on Windows
>> would do the latter, and the Python-for-Windows would do the former.
>> Although, it is not clear what sys.platform will return, yet...)
> It should return Linux.

>From screenshots it looks like lsb_release -a returns the normal
Ubuntu info [1] and uname -a says linux (don't know if that will
change). [2]  So yeah, sys.platform should return Linux.


[1] https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/
[2] https://insights.ubuntu.com/2016/03/30/ubuntu-on-windows-the-ubuntu-userspace-for-windows-developers/

More information about the Python-Dev mailing list