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
add as_sequence()
method on dict views
#2527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I don't know what's wrong on windows and if it's even related to this PR 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I don't know what's wrong on windows and if it's even related to this PR 🤔
Looks like The filename or extension is too long. (os error 206)
...ugh. I don't know what's up with that.
dankjewel @mejrs for the quick review! 🙏 |
Hey, thanks for this. I'm definitely willing to add some methods to these views to improve usability, although I'm not convinced >>> import collections
>>> isinstance({}.keys(), collections.abc.Sequence)
False You can already make use of the fact these views implement If we add methods to these types I would guess the main motivation would either be:
Is it possible that someone could subtype |
Ah you're absolutely right @davidhewitt! Thank you! At first I also added a Thanks again for this library! |
Hi and thank you for this amazing library! I'm trying to help @samuelcolvin on https://github.com/samuelcolvin/pydantic-core. Following #2358, it would be great to have at list a
as_sequence()
method on dict views to be able to easily get length, convert them to list, iterate...I didn't want to add any other methods following @davidhewitt 's comment. Let's keep it simple for now :)