godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Add type hints to `binding_generator.py`

Open Repiteo opened this issue 1 year ago • 2 comments

Makes the main binding file a bit easier to parse by assigning the relevant type hints. The only real change to the script itself were splitting some variables that previously represented multiple types & making the default meta argument "" instead of None so I didn't have to add any Optional type wrappers.

Repiteo avatar Jan 18 '24 21:01 Repiteo

Thanks!

Personally, I have kind of mixed feelings about this. I like typehints, but if we commit to fully typehinting everything, I think it raises the bar somewhat on contributing. This is something that the GDExtension team will need to discuss to decide if we want to do this. I'll add it to the agenda for the next meeting, just in case we don't manage to discuss it here first. :-)

dsnopek avatar Jan 19 '24 03:01 dsnopek

Discussed at the GDExtension meeting, and we agreed that we'd like to follow Godot's lead on this. So, we should have a wider discussion on if we want to use typehints in Godot's Python code in general (and then godot-cpp will follow that decision).

dsnopek avatar Jan 26 '24 16:01 dsnopek