Re: [nox-dev] a code problem about “util.py”

2011-11-03 Thread Murphy McCauley
A function in Python is a first class object. In the code below, f is defined inside of gen_datapath_join_callback, and you get a new f. Since a function is just an object, gen_datapath_join_callback then adds a new property to f -- the cb property. Inside f, this property is accessed. I

Re: [nox-dev] a code problem about “util.py”

2011-11-03 Thread Murphy McCauley
The definition of register_handler is in pycontext.cc in pyrt. It's exposed to Python via SWIG. -- Murphy On Nov 2, 2011, at 10:14 PM, hzy wrote: the code problem I have solved after I looked the python books about function. but, when I look the codes in the core.py. def

Re: [nox-dev] what is the difference between pyswitch and routing module?

2011-11-03 Thread Murphy McCauley
pyswitch is intended to be a very simple demo and does something along the lines of making each switch in the network a standalone L2 learning switch. Each switch gets no insight about the topology from its neighbors. routing actually uses a global view of the topology, and can just generate