Skip to content
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

library: Port 'List View Widget' to Python #826

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theCapypara
Copy link
Contributor

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_item returning the StringObject because it's a StringList)

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.

@theCapypara
Copy link
Contributor Author

theCapypara commented Nov 20, 2023

typing.cast is a no-op (identity function) at runtime.

@UrtsiSantsi
Copy link
Contributor

I feel like typing is overkill for small demos or even small apps and instead distracts from the main purpose.

@theCapypara
Copy link
Contributor Author

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.

@theCapypara theCapypara marked this pull request as draft November 21, 2023 17:17
@UrtsiSantsi
Copy link
Contributor

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
Copy link
Contributor Author

I'll probably end up doing that.

@sonnyp
Copy link
Contributor

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
Copy link
Contributor Author

I'll be back tomorrow and do some cleaning up, also have some PRs to review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants