xml.sax.writer

2006-08-30 Thread Dominic Fox
Hi,

xml.sax.writer doesn't appear in the global module documentation, and
googling for it doesn't tell you all that much either. Is it actually
in the standard libraries, or is it an interloper from something else
(the libxml bindings, say) that just happens to have taken up
residence in the xml.sax namespace?

Dominic

-- 
Shall we be pure or impure? Today
we shall be very pure. It must always
be possible to contain
impurities in a pure way.
--Tarmo Uustalu and Varmo Vene
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tripoli: a Python-based triplespace implementation

2005-05-02 Thread Dominic Fox
> Is there some interoperability requirement with non-Python apps?  If not,
> why not just use pickle or marshal?

I would imagine that much of the existing, current and useful
triple-based data out there is serialized (or serializable) in
RDF/XML. I wouldn't choose it as a serialization format arbitrarily...

Dominic

-- 
// Alas, this comparison function can't be total:
// bottom is beyond comparison. - Oleg Kiselyov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tripoli: a Python-based triplespace implementation

2005-05-02 Thread Dominic Fox
karouri wrote:

> Interesting, but I wonder if you are aware of pylinda
> (http://www-users.cs.york.ac.uk/~aw/pylinda/) and if so, what's the
> difference?

Tripoli trades off some of the generality of PyLinda in order to
support some performance tweaks and some additional graph-related
operations.

Tripoli restricts the tuple space model implemented by PyLinda to
3-tuples, and extends it by adding copy_graph and copy_collect_graph
operations to copy and move graphs of triples from one triple space to
another.

PyLinda allows you to pattern match on types, which is really neat but
makes index-based tuple lookups impractical. Tripoli matches literals
or wildcards only, but it indexes every triple on all three components
so in theory it should be quicker at finding triples, matching blocked
requests to incoming triples and so on. Performance is fairly good
even with large-ish (1+). triple sets.

Some other respects in which I think Tripoli is different, but aren't
familiar enough with PyLinda to say for certain:

Tripoli uses callbacks to notify waiting requestors that a matching
triple has arrived. Requestors can block waiting for a callback, or
continue about their business and handle the callback only when it
occurs. Communication between the Tripoli client and server is
asynchronous: the client sends a triple request, and at some point in
the future the server may contact the client to send a response back.
The REST-ful version will also support client polling of a temporary
resource representing a pending request.

Tripoli will eventually support RDF/XML as a format for importing and
exporting triples.

Dominic
-- 
http://mail.python.org/mailman/listinfo/python-list


Tripoli: a Python-based triplespace implementation

2005-04-30 Thread Dominic Fox
I have been working on a Python implementation of a modified Tuple
Space (cf Linda, JavaSpaces) that contains only 3-tuples (triples),
and that has operators for copying and moving graphs of triples as
well as sets matching a given pattern. It's called Tripoli, and the
code for it can be found here:

http://www.codepoetics.com/code/tripoli

More explanation of what it is and what it's meant to do can be found
in these three blog posts:

http://codepoetics.com/poetix/index.php?p=110
http://codepoetics.com/poetix/index.php?p=111
http://codepoetics.com/poetix/index.php?p=113 (this post includes some
sample code, that may clarify intended usage somewhat)

At present, a simple XML-RPC server is used to expose a "manifold" - a
collection of triple spaces - to multiple clients. I will be
supplementing this with something beefier, and more REST-ful, in due
course - probably based on Twisted.

This is code in the very earliest stages of testing and development -
I would very much welcome comments and suggestions from any intrepid
persons who fancy having a play around with it.

Dominic
--
http://mail.python.org/mailman/listinfo/python-list


Monadic Parser Combinators in Python

2005-03-18 Thread Dominic Fox
Python: Now More Like Haskell Than Ever Before!

I've implemented a small monadic parser combinator library in Python
(based on Haskell code in a paper by Graham Hutton and Eric Meijer).

http://codepoetics.com/poetix/index.php?p=94

It enables you to write things like this:

> token = isalpha |seq| many(isdigit)
> tokens = token |sepBy| whitespace
> runParser("p123 q456 hello world", tokens)
['p123', 'q456']

It is probably entirely unsuited for any serious purpose, but might
qualify as an interesting hack...

Dominic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Concurrent Python

2005-02-14 Thread Dominic Fox
> For an alternative approach (based on using generators forming a dataflow
> component system) you might find our project interesting - the core
> concurrency stuff is packaged up separately with API docs (and trivial
> example) here: http://kamaelia.sourceforge.net/Docs/Axon.html

Would it be correct to characterise this approach as co-operative
multithreading?

I have a feeling that in Python, at least, where threads and locks are
not so cheap, this approach will scale rather better - at the cost of
making some of the thread management explicit (I used to write WIMP
programs on the Acorn Archimedes that had the same basic structure:
message loop picks up messages, does some processing then explicitly
relinquishes control so that other applications can take their turn).
The syntax is also agreeably Pythonic.

I haven't investigated Stackless in much detail, but I believe it
makes a lot of these trade-offs moot - no need to simulate coroutines
when you have the real thing...

Anyway, thanks for this - I have linked it from the CTM in other
languages page of the CTM Wiki:

http://codepoetics.com/wiki/index.php?title=Topics:CTM_in_other_languages#Concurrency_in_Python

Dominic
-- 
http://mail.python.org/mailman/listinfo/python-list


Concurrent Python

2005-02-11 Thread Dominic Fox
I've created a few classes to support some concurrent programming
concepts in Python:

AsyncResult represents the state of a process currently running in a
separate thread.
MultiEvent allows listeners to wait for any one of a list of events to
be signalled.
MultiQueue allows listeners to wait for an item to be added to any one
of a list of queues.
DataflowObject can be used to block while waiting for a
single-assignment variable to be bound.

The code can be found here:

http://www.codepoetics.com/code/concurrent.py

Comments and constructive criticism welcome.

regards,
Dominic
-- 
http://mail.python.org/mailman/listinfo/python-list