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

Consider adding NonEmptyList #257

Open
sobolevn opened this issue Feb 7, 2020 · 5 comments
Open

Consider adding NonEmptyList #257

sobolevn opened this issue Feb 7, 2020 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sobolevn
Copy link
Member

sobolevn commented Feb 7, 2020

Currently, Python does not have any valid type elements to work with lists.
And while List itself is good enough for collections and other things, sometimes we need to explicitly mark some list to have at least one argument.

Related: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/

@DaniilDaedalus
Copy link

DaniilDaedalus commented Oct 5, 2022

@sobolevn i would like to contribute. But should this type be a part of returns? I came here googling for NonEmptyList type and definitely didn't expect to find something related in returns package 😁

@sobolevn
Copy link
Member Author

sobolevn commented Oct 5, 2022

You can create a new package :)

@DaniilDaedalus
Copy link

@sobolevn well, actually if the point of returns is to "Make your functions return something meaningful, typed, and safe!", then i guess it makes sense to have NonEmptyList here. Is it ok if i put it somewhere in returns.primitives.types? 🤔

@simon-liebehenschel
Copy link

simon-liebehenschel commented Jul 23, 2023

I found this issue via web search. The feature request is valid, but rather than every developer will maintains own type hints, I think it makes sense to collaborate with maintainers of an existing solution, e.g. https://github.com/annotated-types/annotated-types or Pydantic.

@thepabloaguilar
Copy link
Member

@sobolevn maybe returns is not the place for this type! Thinking about what we have now it doesn't make much sense on adding a NonEmptyList type just to provide our implementation while people can rely in specific libraries for that like phaton-types NonEmpty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

4 participants