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

question #17

Closed
ehsanmavaei opened this issue Dec 20, 2019 · 3 comments
Closed

question #17

ehsanmavaei opened this issue Dec 20, 2019 · 3 comments
Labels
question Issue is a question

Comments

@ehsanmavaei
Copy link

ehsanmavaei commented Dec 20, 2019

hi Alexandre Decan
I have been using your library and it has been really useful however, I want to know if there is a way to output an interval as an array of numbers?
for example :
print( I.closed(0, 5)) returns something like [0, 1, 2, 3, 4, 5]

@AlexandreDecan
Copy link
Owner

Hello,
Thanks for the feedback!

Yes, there is a way to output such list of numbers. The library provides an iterate method that (among other) accepts an Interval instance and an increment. It returns a generator object on which you can iterate as usual:

>>> list(I.iterate(I.closed(0, 5), incr=1))
[0, 1, 2, 3, 4, 5]

The documentation for this function is available at https://github.com/AlexandreDecan/python-intervals#discrete-iteration

@AlexandreDecan AlexandreDecan added the question Issue is a question label Dec 21, 2019
@ehsanmavaei
Copy link
Author

Hello,
Thanks for the feedback!

Yes, there is a way to output such list of numbers. The library provides an iterate method that (among other) accepts an Interval instance and an increment. It returns a generator object on which you can iterate as usual:

>>> list(I.iterate(I.closed(0, 5), incr=1))
[0, 1, 2, 3, 4, 5]

The documentation for this function is available at https://github.com/AlexandreDecan/python-intervals#discrete-iteration

yeah got it ,it does that too and thank you for replying so fast, I really enjoyed the functionality of this library which is unique its own way . hope you the best

@AlexandreDecan
Copy link
Owner

You're welcome!

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

No branches or pull requests

2 participants