[Python-Dev] Returning Windows file attribute information via os.stat()

Victor Stinner victor.stinner at gmail.com
Tue Jun 10 11:34:57 CEST 2014


2014-06-10 6:02 GMT+02:00 Ben Hoyt <benhoyt at gmail.com>:
> To solve this problem, what do people think about adding an
> "st_winattrs" attribute to the object returned by os.stat() on
> Windows?
> (...)
> FILE_ATTRIBUTE_HIDDEN = 2  # constant defined in Windows.h
>
>     if hasattr(st, 'st_winattrs') and st.st_winattrs & FILE_ATTRIBUTE_HIDDEN:

I don't like such API, it requires to import constants, use masks, etc.

I would prefer something like:

   if st.win_hidden: ...

Or maybe:

   if st.winattrs.hidden: ...

Victor


More information about the Python-Dev mailing list