Next / Previous / Contents / Shipman's homepage

6.5. PathInfo.isFile(): Is this an ordinary file?

The standard Python stat module contains a function called S_ISREG() that takes the mode bits as an argument and returns true if the mode bits describe a regular file, false otherwise.
# - - -   P a t h I n f o . i s F i l e   - - -

    def isFile ( self ):
        """Predicate to test whether this path is an ordinary file.

          [ if self represents an ordinary file ->
              return a true value
            else ->
              return a false value ]
        return  stat.S_ISREG ( self.mode )