Let us assume I would like to implement a linked list using GObject in python. I would start with this code:
class Item(GObject.Object):
value = GObject.Property(type=int)
next_item = GObject.Property(type=Item)
If one tries to run this code snippet then they will see that python complains about “type Item is undefined on line 3”. Essentially, I cannot use the type “Item” in the property until the class “Item” completes its definition.
I could not find a way to have a forward declaration with GObject: Unlike using string in python itself
class Item:
value: int
next_item: 'Item'
GObject typing system seems to be not designed to accept strings as a forward declaration of types.
Is this a known deficiency in PyGObject or do I miss something?