This seems to just be a basic Python programming problem. The "mem = []" line creates a new list. Then you are adding one element to it. Then you're throwing it away. The next time the code executes (apparently in a PacketIn handler), it creates a new list, adds an item, and throws it away again.
You need to save the list somewhere by having a reference to it in a non-local scope. If your PacketIn handler is a method on an object, maybe the object would be the right place. Generally, you'd initialize it in the class's __init__() method, by setting self.mem = [], and then referencing it later (in the PacketIn handler) using self.mem.append() for example. Good luck. -- Murphy On Mar 11, 2014, at 2:23 PM, Marcus Sandri <mww...@gmail.com> wrote: > Hello All, > > > Problem in storing values in data-structures > > > Hello All, > > > I'm trying to store values into data structures, specifically lists. I've > tried to use Append() method to append new values in my list as always. But > as far as I know, when I run the controller, it just store values one time. > > An example: > > packet = event.parsed > mem = [ ] > mem.append(packet) > > print "\nMEM:\n" > for item in mem: > print "\n Length of list:", len(memoize) > > > It will return: Length of list: 1 all time. > > > Am I doing something wrong? > > > Cheers, > Marcus.