Paul Rubin <[email protected]>:
> Marko Rauhamaa <[email protected]> writes:
>> As swapping is no longer considered normal on modern computers, the
>> memory-disk duality doesn't seem all that practical anymore. Rather,
>> you'd like to treat the disk analogously to network access and keep
>> RAM access separate.
>
> Yep. But opening disk files that way seems to require threads or extra
> processes.
At the moment, yes. But in the ideal world, everything would be
(optionally) nonblocking. So open(O_NONBLOCK) would return a file
descriptor before the system knows if the requested pathname refers to a
valid file.
Or maybe we should introduce a new "socket" family: AF_FILE. You would
do:
f = socket.socket(socket.AF_FILE, socket.SOCK_STREAM, "rwb")
f.setblocking(False)
try:
f.connect(pathname)
except socket.error as e:
if e.errno != errno.EINPROGRESS:
raise
...
...
Marko
--
https://mail.python.org/mailman/listinfo/python-list