Solution: Direct access to Printer I/O lines

Alex Martelli aleaxit at
Mon Dec 18 12:28:14 EST 2000

<jkndeja at> wrote in message news:91l4co$jua$1 at
> Hi Alex,
> OK, without (yet...) going too deep into the more-generalised-and-
> interesting patterns discussion developing here:
> If I/you/we don't want singleton objects, but _do_ want to avoid having
> multiple processes accessing a single port, how about this:

Seems nice, though I'd call the method which acquires the resource
'acquire' rather than 'claim' -- but that's quibbling.  __del__
would also be defined, and duplicate the functionality of .release
if need be (but it IS best to have an explicit releasing-method
as well, since, for example, client-code might need to do some writing,
then keep the port-handle around for some more reading, being able
to release it for writing in the meantime -- but also, for more
general reasons).

The only issue (which depends on the device attached to the
port, alas...) is IF reading is actually 'non-invasive' so it
can be allowed without requiring 'acquisition'.  I guess in
most cases it will be, but...


More information about the Python-list mailing list