-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look into multiple dispatch helpers for cleaning up GUI event code #2313
Comments
Bear in mind, every if statement is going to become an annotated method
declaration, so total lines of code may increase.
…On Thu, Jul 25, 2024, 2:26 PM Paul ***@***.***> wrote:
Enhancement request:
*TL;DR:* Consider one of the other dispatch tools to clean up GUI event
code
What should be added/changed?
Consider one of the following to clean up our event code:
1. functools.singledispatchmethod
<https://docs.python.org/3/library/functools.html#functools.singledispatchmethod>
2. The 3rd party multipledispatch
<https://github.com/mrocklin/multipledispatch/>
3. Beartype's plum <https://github.com/beartype/plum>
Why wait til 3.0+?
There might be unexpected problems which would delay 3.0.
The status of the following are unclear:
1. Union types and arguments
- functools.singledispatch
<https://docs.python.org/3/library/functools.html#functools.singledispatchmethod>
only got Union support in 3.11
- Where does that leave singledispatchmethod
<https://docs.python.org/3/library/functools.html#functools.singledispatchmethod>
?
2. It looks like there are issues with inheritance as of a month ago
<https://stackoverflow.com/questions/68190543/how-to-use-singledispatchmethod-with-inheritance-class>
What would it help with?
Reduce verbosity in cases like this:
https://github.com/pythonarcade/arcade/blob/05b476f5bbe3e02a2a7352d67e5daa980e7f489b/arcade/gui/widgets/text.py#L432-L477
—
Reply to this email directly, view it on GitHub
<#2313>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35ODWCKMQFWB2WILJBP3ZOE7LRAVCNFSM6AAAAABLPCTRJOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTANZSG42DONQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi, from my point of view, we do not have to enforce a decision You can just create a UIWidget, which passes the events to the singledispatch function. Side note: I personally try to stick to the current arcade "statement":
My conclusion is, it should be easy to understand for beginner, or have to be optional. |
Enhancement request:
TL;DR: Consider one of the other dispatch tools to clean up GUI event code
What should be added/changed?
Consider one of the following to clean up our event code:
functools.singledispatchmethod
multipledispatch
plum
Why wait til 3.0+?
There might be unexpected problems which would delay 3.0.
The status of the following are unclear:
Union
types and argumentsfunctools.singledispatch
only gotUnion
support in 3.11singledispatchmethod
?What would it help with?
Reduce verbosity in cases like this:
arcade/arcade/gui/widgets/text.py
Lines 432 to 477 in 05b476f
The text was updated successfully, but these errors were encountered: