Skip to content
  • Christoph Reiter's avatar
    Use a named tuple for returning multiple values · 175d1066
    Christoph Reiter authored
    >>> v = Gtk.Button().get_alignment()
    >>> v
    (xalign=0.5, yalign=0.5)
    >>> v.xalign
    0.5
    
    For each GICallable a new gi._gi.ResultTuple subclass
    is created which knows the return value names of that
    callable and displays them in __repr__, __dir__ and
    allows to access tuple items by name.
    
    The subclass is cached in PyGICallableCache.
    
    To reduce the number of small tuple allocations use a free list
    similar to the one used for pure tuples in CPython.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727374
    175d1066