[Python-Dev] End of the line

Jack Jansen jack@oratrix.nl
Tue, 27 Jul 1999 14:04:39 +0200


> What Im getting at is that a Python IO model should maybe go a little
> further than "tradtional" IO - asynchronous IO and synchronisation
> capabilities should also be specified.  Of course, these would be optional,
> but it would be excellent if a platform could easily slot into pre-defined
> Python semantics if possible.

What Python could do with reasonable ease is a sort of "promise" model, where 
an I/O operation returns an object that waits for the I/O to complete upon 
access or destruction.

Something like

def foo():
	obj = stdin.delayed_read()
	obj2 = stdout.delayed_write("data")
	do_lengthy_computation()
	data = obj.get()	# Here we wait for the read to complete
	del obj2		# Here we wait for the write to complete.

This gives a fairly nice programming model.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm