Re: fcntl example

Guido.van.Rossum@cwi.nl
Tue, 03 May 1994 12:37:46 +0200

> Or provide an interface that returned an error if it wasn't
> implemented on some systems, thus allowing a program to do an
> alternative that was available or not do locking or just give up,

(The following is written presuming that when you write return an
error, you mean to raise an exception.)

Actually, not providing an interface will also raise an exception when
used. The advantage over providing the interface on all systems but
raising an exception when it can't be implemented is that the caller
can test for the presence of the interface (e.g. by using hasattr(f,
'lock')).

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>