If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions

Tuesday, September 07, 2010

Getting last N items of iterator

islice allow you to get the first N items of an iterator, but since it doesn't accept negative indexes - you can't use it to get the last N. The solution is very simple - use deque.


2 comments:

Anonymous said...

You have broadened my knowledge :)
Love it when its small a simple. Thanks.

Unknown said...


Thanks for sharing the comment. Keep updating more and more
SEO Training
Java Training
python Training
Salesforce Training
Tableau Training
AWS training
Dot Net Training
DevOps Training
Selenium Training

Blog Archive