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

Add "list_of(type)" and "dict_of(key_type, val_type)" validators #168

Closed
sscherfke opened this issue Mar 20, 2017 · 1 comment
Closed

Add "list_of(type)" and "dict_of(key_type, val_type)" validators #168

sscherfke opened this issue Mar 20, 2017 · 1 comment

Comments

@sscherfke
Copy link
Contributor

x = attr.ib(validator=instance_of(list)) is IMO not a very useful check, but x = attr.ib(validator=list_of(type)) would be.

In a similar fashion we could also add a dict_of(key_type, val_type) validator.

I can create a pull request if you like this idea.

@hynek
Copy link
Member

hynek commented Mar 21, 2017

We’re getting this request regularly. You may want to look into the discussion around #158 to what I’m envisioning if you’d like to supply a solution.

@hynek hynek closed this as completed Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants