You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add pop() method to list-like model objects to ease their usage #2303
In a prerun modifier, you may want to remove the last item in the list of keywords. Right now you have to do that via slicing -- it would be cleaner to support the pop in the keyword object. This would require adding the pop method to the ItemList object which in turn is inherited by the keyword object.
pop should accept optional index and return the popped item like list.pop does. Easiest implementation would be converting the internal data to a list, popping it, and setting internal data again. Testing best done with unit tests.
You might also want to check are there other list methods that could be added.
Activity
jaloren commentedon Jan 18, 2016
This may be used to implement #2302
jaloren commentedon Jan 18, 2016
To implement this, do i just need to add the following function to the ItemList class in model/itemlist.py
pekkaklarck commentedon Jan 18, 2016
popshould accept optionalindexand return the popped item likelist.popdoes. Easiest implementation would be converting the internal data to a list, popping it, and setting internal data again. Testing best done with unit tests.You might also want to check are there other list methods that could be added.
pekkaklarck commentedon Feb 24, 2016
Are you @jaloren interested to implement this? I can easily do it myself too.
jaloren commentedon Feb 25, 2016
I am swamped at work right now -- please feel free to do the code submit.
[-]Add pop to ItemList for Keyword Object[/-][+]Add `pop()` method to list-like model objects to ease their usage[/+]