Python Glossary Русский

Python 3.4+statfunction

stat.S_ISPORT()

file type

Checks from st_mode that the object is an event port, a Solaris event mechanism. Always False elsewhere.

Syntax

stat.S_ISPORT(os.stat(path).st_mode)

Like S_ISDOOR, it was added in 3.4 for completeness: the function is available everywhere, but the stat.S_IFPORT constant is 0 outside Solaris and the answer is always False. Exercises never need it; if you meet it in someone's code, it is a portable placeholder, not a check that finds anything on Linux.

Examples

import os, stat
os.mkdir('d')
print(stat.S_ISPORT(os.stat('d').st_mode))  # → False
print(stat.S_IFPORT)  # → 0 (на Linux, macOS и Windows)

See also

Open in the full glossarydocs.python.orgReport an inaccuracy