kshitij10496 / gh-notifier

Desktop notifier for all your "social" GitHub notifications
MIT License
20 stars 10 forks source link

Exceeding the limit set by the user #4

Closed kshitij10496 closed 8 years ago

kshitij10496 commented 8 years ago
In [1]: from ghscrap.scrapper import search_location
In [2]: spam = search_location("Kharagpur", max_users=15)
In [3]: len(spam)
Out[3]: 20

Currently, the number of users returned by the function search_location exceeds the limit set by max_users. We need to implement this restriction.

kshitij10496 commented 8 years ago

Ping @zorroblue ! Since @Arafatk is working on #2 , it would be good if you can contribute on this issue.

kshitij10496 commented 8 years ago

Reply to @Arafatk comment here

Another simple way would be to use a deque and set it maxlen parameter(and break when deque size reaches maxlen). Although I am not sure if its 'better'.

Deque has better performance than list for operations like pop. Reference However, I feel it would be an overkill for this task. Also, another thing to note is that deque doesn't support slicing.

So, I would prefer to use a list here. A length check should work fine.