Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
theCapypara wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from capypara/py-list-view

Conversation

@theCapypara
Copy link
Contributor

@theCapypara theCapypara commented Nov 20, 2023

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.

Copy link
Contributor Author

theCapypara commented Nov 20, 2023
edited
Loading

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

Copy link
Contributor

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

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.

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?

Copy link
Contributor Author

I'll probably end up doing that.

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

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

Reviewers

No reviews

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /