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

Support for Set in addition to List and Tuple? #120

Open
proofit404 opened this issue Dec 12, 2021 · 3 comments
Open

Support for Set in addition to List and Tuple? #120

proofit404 opened this issue Dec 12, 2021 · 3 comments

Comments

@proofit404
Copy link

Hi, thanks for the useful package!

Is there any technical reason behind Set support absence?

Or I'm a very first person who actually needs it?

If it's missed because no one needs it yet, and maintainers are not against it, I would like to provide pull request with such implementation. Documentation and tests included.

Hopefully, new minor release would be issued after this contribution.

Thoughts?

Regards,
Artem.

@Deepwalker
Copy link
Owner

I'm not against, of course. Did not include it, because generally, when you get something from internet in json, it is definitely does not include sets, instead it has list/array, and then you check that members of this set is uniq and then call set, like t.List() & uniq & set.
To check python structs, you can use t.Type(set).
Not sure what is you case, I'm open to new contributions.

@proofit404
Copy link
Author

I use trafaret as normalization library in the service layer of my application.

For example, here and there, now and then.

So, in my case it supposed to be used for:

  • value is a set of elements of right type
  • value could be normalized to set
  • items of value could be normalized to specified type

If I understand correctly, it could be expressed already but would require a complicated expression instead of just Set.

@Deepwalker
Copy link
Owner

Deepwalker commented Dec 13, 2021

In this case I vote for Set trafaret.

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