On this page
  1. genericpath.sameopenfile
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

genericpath.sameopenfile

Prev: genericpath.samefile | Up: genericpath | Next: genericpath.samestat
Rel: genericpath.commonprefix, genericpath.exists, genericpath.getatime, genericpath.getctime
Ref: docs.python.org — genericpath.sameopenfile
Tags: #public #python3 #stdlib #genericpath


Import

import genericpath
from genericpath import sameopenfile

Signature & Overview

genericpath.sameopenfile(fp1, fp2)

Test whether two open file objects reference the same file

Usage

import os
import tempfile

with tempfile.TemporaryFile() as f:
    assert os.path.sameopenfile(f.fileno(), f.fileno()) is True

Gotchas

REPL Inspect

from genericpath import sameopenfile
help(sameopenfile)

Linked from

Related notes