mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
use file() in preference to open()
This commit is contained in:
parent
7db865af40
commit
2ccf5d689b
1 changed files with 3 additions and 3 deletions
|
@ -153,11 +153,11 @@ Examples (all on a SVR4 compliant system):
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
import struct, fcntl
|
import struct, fcntl
|
||||||
|
|
||||||
file = open(...)
|
f = file(...)
|
||||||
rv = fcntl(file, fcntl.F_SETFL, os.O_NDELAY)
|
rv = fcntl(f, fcntl.F_SETFL, os.O_NDELAY)
|
||||||
|
|
||||||
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
|
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
|
||||||
rv = fcntl.fcntl(file, fcntl.F_SETLKW, lockdata)
|
rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
Note that in the first example the return value variable \var{rv} will
|
Note that in the first example the return value variable \var{rv} will
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue