-
-
Notifications
You must be signed in to change notification settings - Fork 90
library: Port 'List View Widget' to Python #826
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
Conversation
typing.cast is a no-op (identity function) at runtime.
UrtsiSantsi
commented
Nov 21, 2023
I feel like typing is overkill for small demos or even small apps and instead distracts from the main purpose.
theCapypara
commented
Nov 21, 2023
Right now the primary idea is to have a second language option "Python (typed)" that would use the normal Python source, and then "Python" would show the source stripped of type checks, ideally by an automated tool.
I will put this to draft for now.
UrtsiSantsi
commented
Nov 21, 2023
I saw the discussion - maybe it can be extended to some kind of "Best practices" toggle?
Why don't you merge this without the type check and add it back later if\when the infrastructure is ready?
theCapypara
commented
Nov 21, 2023
I'll probably end up doing that.
sonnyp
commented
Mar 23, 2024
@theCapypara can you reopen against https://github.com/workbenchdev/demos/ ?
Please note we now have separate Grid View, List View and Column View
theCapypara
commented
May 30, 2024
I'll be back tomorrow and do some cleaning up, also have some PRs to review :)
This is the first demo that would use
typing.cast. What is your opinion in that?I feel like with data driven APIs like this, and due to the fact it relies much less on the already established global objects than other demos, showing the user a good way to be able to properly type this is both useful to know for real world apps and also makes some parts of the demo easier to read, since it's now clear from the code how the different objects are related (eg.
ListItem.get_itemreturning theStringObjectbecause it's aStringList)The downside is that casts can't really be checked statically. So in theory this could break, but in practice even if it would, the demo also wouldn't work properly then anyway.