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

[FAQ] Any in dict, allow using any type #417

Open
steeling opened this issue Jul 13, 2024 · 1 comment
Open

[FAQ] Any in dict, allow using any type #417

steeling opened this issue Jul 13, 2024 · 1 comment
Labels
faq good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Comments

@steeling
Copy link

When dealing with a dict of type {str:Any}, we can't set values to {'key': 'value'} because 'value' is of type str which fails type assertions.

Would be a nice to have to allow duck typing on Any

@Peefy
Copy link
Contributor

Peefy commented Jul 14, 2024

Sorry, do you mean the any type or the Any type?

config1: {str:any} = {'key1': 'value', 'key2': 1}
config2: {str:} = {'key': 'value'} # We can omit the any in the type annotation.

@Peefy Peefy added question Further information is requested help wanted Extra attention is needed labels Jul 14, 2024
@Peefy Peefy transferred this issue from kcl-lang/kcl Jul 15, 2024
@Peefy Peefy added faq good first issue Good for newcomers labels Jul 15, 2024
@Peefy Peefy changed the title Any in dict, allow using any type [FAQ] Any in dict, allow using any type Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants