Re: Python bindings: comments and suggestions
Daniel Veillard <[email protected]> Wed, 29 May 2002 10:44:50 -0400
| Newsgroups | gmane.comp.gnome.lib.xml.bindings |
|---|---|
| Message-ID | <[email protected]> |
On Wed, May 29, 2002 at 04:07:50PM +0200, Alexandre wrote: > Hi there, > > I've been giving a try to the libxml2/libxslt1 python bindings. > > It's nice and fast, though a bit surprising at first. The mapping from > the C api to the Python api is not very clear to me. If someone could > point me to some documentation, I'd be grateful. hum, the mapping is automated, it's basically a python script using the XML formal definition of the API and generating stubs + a bit of glue code the script is called generator.py in the source distributions python subdir the mapping is defined by making some C type python classes and transforming functions into methods at the python level for those classes. > An (small) improvement could be to make the second argument to > parseMemory optional, and have it default to the length of the string, > since I cannot imagine an use case where it would be different. yup, again it's automatically generated, and in that specific case the mapping ain't nice, best would be to put a bit of python glue to define more pythonish APIs > Another point is in libxml2.py, the comment for the serialize and saveTo > methods (btw, I think these should be docstrings) mention an indent > argument while the real parameter is called format. hum, right, that part is part of the not-generated glue code (libxml.py which ends up at the top of libxml2.py) I fixed the description, thanks, Daniel -- Daniel Veillard | Red Hat Network https://rhn.redhat.com/ [email protected] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/