Hello, I'm trying to work on GNU Radio and having trouble understanding some of the Python code. I have a C/C++ coding background. I'm looking at the ieee802.15.4 code found on CGRAN. It's about 4 years old and runs but doesn't function anymore so I'm trying to fully understand it to fix it.
In one file (a file in src/example called cc2420_txtest.py) I have the following line from a constructor for: class transmit_path(gr.top_block) ... ... ... self.packet_transmitter = ieee802_15_4_pkt.ieee802_15_4_mod_pkts(self, spb=self._spb, msgq_limit=2) Now in the src/python directory for this project I have ieee802_15_4pkt.py which has the following class: class ieee802_15_4_mod_pkts(gr.hier_block2): """ IEEE 802.15.4 modulator that is a GNU Radio source. Send packets by calling send_pkt """ def __init__(self, pad_for_usrp=True, *args, **kwargs):[/code] What I don't understand is the call to the constructor and the constructor definition. Since it's using a number of advanced features, I'm having trouble looking it all up in documentation. What does it mean to call with spb=self._spb? In the example file, spb is set = to 2 and so is self._spb. Is it a sort of pass by reference like C while also assigning a value? Why the ** on kwargs then? as if it is a matrix (and does anyone have any idea what kwargs are (as opposed to args)?) I'm uncertain about the first argument, but I guess it must be the transmit_path object passed in place of the usually implicit self... I'm just not sure how Python figures out that it's not pad_for_usrp... magic I guess! Thanks for your help, Dave _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor