Closed justvanrossum closed 2 years ago
I'm glad you are finding the user_data useful!
I'm glad you are finding the user_data useful!
Totally! It appears to me this is exactly what user_data
is good at: passing method-specific implementations. DrawFuncs
objects should do the same for the pure Python callbacks.
Totally! It appears to me this is exactly what
user_data
is good at: passing method-specific implementations
Correct. That's what they are for.
Typically the user_data is bound to the method to call for that particular call, whereas the draw_data is bound to the instance.
I've got to say what you and Khaled are doing with this API is all magic to me.
Right. In this case user_data
is both, as I'm using it to pass bound methods.
I've got to say what you and Khaled are doing with this API is all magic to me.
A well designed API allows its users to do things not imagined by its designers 😉 (I think there was a saying somehow like that, or may be I’m making things up)
Pre-fetching the pen instance methods and passing them via
user_data
speeds up pen drawing by another 10-15%.