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

Result dictionary with str type keys #184

Open
YooSunYoung opened this issue Sep 16, 2024 · 2 comments
Open

Result dictionary with str type keys #184

YooSunYoung opened this issue Sep 16, 2024 · 2 comments

Comments

@YooSunYoung
Copy link
Member

I had a feed back about sciline interface that it can be cumbersome to import all the types you need to retrieve results.

It might be helpful to have a helper function that turns dict[type, Any] into a dict[str, Any]...?

@jl-wynen
Copy link
Member

This may not be as usable as you think. We would have to use the fully qualified names of types to avoid collisions:

>>> res = {int: 3, float: 4.1}
>>> toolz.keymap(sciline._utils.key_full_qualname, res)
{'builtins.int': 3, 'builtins.float': 4.1}

Is spelling out modules really better than importing names?

@YooSunYoung
Copy link
Member Author

This may not be as usable as you think. We would have to use the fully qualified names of types to avoid collisions:

>>> res = {int: 3, float: 4.1}
>>> toolz.keymap(sciline._utils.key_full_qualname, res)
{'builtins.int': 3, 'builtins.float': 4.1}

Is spelling out modules really better than importing names?

No I don't think so. I much prefer using the dedicated type-object than string-keys.

But the original idea was not my opinion...

I opened it to see if anyone else has the similar feedback.

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

No branches or pull requests

2 participants