GNOME Bugzilla – Bug 696027
Support iteration and indexing on structs
Last modified: 2018-01-10 20:23:48 UTC
The idea is to add generic support for __iter__ to the Boxed and Struct types. This will allow better compatibility with PyGTK as well as being a general convenience for Python programming. PyGTK generally did not expose structs and instead used tuples for data and this will also help compatibility through a generic technique. There are a handful of functions which either replicate this behaviour for certain structs in overrides when returned, would benefit from the proposal, or the behaviour has been removed in PyGI and would help compatibility with PyGTK: Gdk.Color Gdk.RGBA Gdk.Rectangle Gtk.TargetEntry Gtk.Border GObject.SignalQuery Clutter.Point Clutter.Size Clutter.Vertex Clutter.Geometry Clutter.Knot Clutter.ActorBox Pango.Rectangle A second part of this proposal would be to allow coercion from tuples and dicts to Structs when marshaling from Python (similar to bug 686261). The benefit of this (and the above) is not only in removal of overrides which provide a similar thing, but more importantly it will guarantee API consistency throughout all methods which accept a particular struct instance as well as a tuple (Widget.drag_dest_set_target_list and related methods for example)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/48.