Argument types in python

Simon McVittie simon.mcvittie at collabora.co.uk
Sat Nov 10 08:09:34 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 10 Nov 2007 at 12:21:48 +0100, Janosch Peters wrote:
> sig=dbus.Signature('o')
> cons = dbus.Array( sig )                 #isn't 'cons' of type="ao"?

No, cons is a dbus.Array of unspecified type, containing a
dbus.Signature object.

In dbus-python, 'out' arguments are returned, as usually happens in
Python. In this case you just call:

    interface.ListConnections()

which will return a dbus.Array of dbus.ObjectPath (signature 'ao'), whose
repr() will be something like:

    dbus.Array([dbus.ObjectPath('/foo'), dbus.ObjectPath('/bar')],
               signature='o')

This hopefully also illustrates the correct way to make an empty array of
object-paths, should you ever need one.

    Simon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFHNde+WSc8zVUw7HYRAgcxAJ4rOTdbLsUOUbrZewIxWxzHAkPOngCgpzzS
WjHB5HFTkO98zG+UxA09/e8=
=HEF8
-----END PGP SIGNATURE-----


More information about the dbus mailing list