os.supports_fd

os.supports_fd

A Set object indicating which functions in the os module permit specifying their path parameter as an open file descriptor. Different platforms provide different functionality, and an option that might work on one might be unsupported on another. For consistency’s sakes, functions that support fd always allow specifying the parameter, but will raise an exception if the functionality is not actually available.

To check whether a particular function permits specifying an open file descriptor for its path parameter, use the in operator on supports_fd. As an example, this expression determines whether os.chdir() accepts open file descriptors when called on your local platform:

os.chdir in os.supports_fd

New in version 3.3.

doc_python
2016-10-07 17:40:03
Comments
Leave a Comment

Please login to continue.