Argument Type Subclasses

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
D-Bus defines separate types for arguments of type “object path”,
“signature” and “Unix FD”, so I thought it made sense to do the same in
my Python binding <https://github.com/ldo/dbussy>. These are subclasses
of string and integer, and the base classes are still acceptable for
those arguments, but the retrieved values are always of the appropriate
subclass:

    import dbussy

    msg = dbussy.Message.new_method_call \
      (
        destination = "com.example",
        path = "/com/example",
        iface = "com.example",
        method = "something"
      ).append_objects("vh", ("s", "stderr"), 2)
    print("path = %s" % repr(msg.path))
    print("args = %s" % repr(msg.all_objects))

produces output

    path = ObjectPath('/com/example')
    args = [(Signature('s'), 'stderr'), UnixFD(4)]
_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.