Python bindings feature complete

Havoc Pennington hp at
Fri Feb 11 12:56:47 PST 2005

On Fri, 2005-02-11 at 15:17 -0500, John (J5) Palmieri wrote:
> * Recursive types are stuck with restrictions of the C api such as all
> array and dict elements must be of the same type.

Even in dynamic languages IMO it's sort of crackrock to store multiple
types in one container. (Where "multiple types" means you do RTTI;
multiple subclasses of one base class is cool)

In other words this is a bad hack even in python:
 foreach item in list:
   if isinstance (item, str):
   elif isinstance (item, integer):

You get the point.

For dicts it's more OK but the usual case is that it's defined which
type the value for a given key will have and the type of dict is

So then you avoid the isinstance() by knowing the key.

>   While I could have
> made the bindings use variants everywhere this would make using python
> to call into C services impossible.  Once introspection is implemented
> this should not be an issue.

Exactly, using variants everywhere isn't right.

> * Optimizing signature creation.  Right now when we need to get a
> signature of a container's children we recurse all the children.  This
> is done each time we need the signature, whether or not we have
> traversed the children already for a higher level container.  For
> example a data structure of signature aaai would recurse three times:
> aai
> ai
> i

Probably isn't really that slow once you consider all the other stuff
that's going on.

> In order to work with some applications which send variable length
> parameter lists instead of sending a list as one of the parameters
> (*cough*Hal*cough*) 

I think HAL is just busted here now that we have array of variant. Lots
of bindings won't be able to handle this.


More information about the dbus mailing list