[Xcb] python bindings

Barton C Massey bart at cs.pdx.edu
Tue Jul 3 11:39:19 PDT 2007


In message <200707031541.27268.hto at arcor.de> you wrote:
> I've put online a _very_ unstable version of my Python
> bindings.

Super!

> I've mainly published now because there are some problems
> which I am not sure how to address:
> 
> 1) <request name="GetAtomName" opcode="17"> has reply with a list:
>       <list type="CARD8" name="name">
>         <fieldref>name_len</fieldref>
>       </list>
> 
>    I think this should be changed to type="char" because
>    it is a STRING8.

Agreed.

> 2) The iterator-API is really hard to handle &
> understand. I tried to explain it to a friend of mine and
> it took him hours to "get it".  (And I believe that he is
> pretty smart ;)

Yeah.  It's one of those things that we chucked in there
because we needed something and couldn't figure out anything
better offhand.  I'm not super proud of it, and it was
mostly my idea.  Better docs and a specific tutorial would
probably help, but it would be cool if we could just replace
the whole mess with something nicer.

>    In the Python binding I prefetch all values into a
>    tuple when the list is accessed the first time. That
>    means that there is a member in the
>    struct/reply/event/error for each list.
> 
>    We could reproduce that in c with the following system:

I'm just being dense, I'm sure, but I didn't understand your
proposal.  In particular, how does it differ from the
"ignore the iterators" option of the existing setup, as
discussed earlier on this list?

> 3) Lists of type "void". There are some lists which have
> CARD8, 16 or 32 as their type, depending on one of the
> arguments. This is solved by using a "void" pointer in
> c. This cannot be mapped to Python. So I introduced some
> special cases for "ChangeProperty" and "GetProperty" which
> are the only places with void lists so far. Are there
> better ideas?

This should probably be fixed in C to use a union type.  I
don't know what the right thing is in Python.


Nice work.

BTW, don't expect any comments from Jamey for another week
or so.  He went and got married, go figure, and is now on
his honeymoon in Hawaii.

    Bart


More information about the Xcb mailing list