Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-28 Thread dave
Yes that is roughly what I meant. GNU Radio uses a lot of sub-classing--if this is the correct term. For example all blocks inherit hier_block2 which has methods such as connect for connecting two blocks together. I wondered if the instance named self wasn't being passed as a replacement for the

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-26 Thread Steven D'Aprano
dave wrote: Is it even possible to replace the implicit self argument of the initializer by passing something else? If so, what would be the syntax. Yes, by calling an "unbound method". Consider this class: class MyClass: def func(self, x): return x+1 When you run this code,

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-26 Thread Alan Gauld
dave wrote: Is it even possible to replace the implicit self argument of the initializer by passing something else? If so, what would be the syntax. Im not sure this is what you mean but... When you call a method on an object like: class MyClass: def aMethod(self,spam): pass anObject= M

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-25 Thread dave
Is it even possible to replace the implicit self argument of the initializer by passing something else? If so, what would be the syntax. If you want to look at the code its all here: https://www.cgran.org/browser/projects/ucla_zigbee_phy/trunk/src The cc2420_txtest.py is in ./examples and the c

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-24 Thread dave
I was dimly aware of the functioning of booleans, but I see now that it doesn't specify an actual boolean type. Still, the code confuses me. Is the usage of pad_for_usrp consistent with it being treated as a boolean? Why would the entire self reference be transmitted then? Example code again:

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-24 Thread Steven D'Aprano
dave wrote: I was dimly aware of the functioning of booleans, but I see now that it doesn't specify an actual boolean type. Still, the code confuses me. Is the usage of pad_for_usrp consistent with it being treated as a boolean? Why would the entire self reference be transmitted then? Parame

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-24 Thread Wayne Werner
On Sun, Jul 24, 2011 at 2:07 AM, Steven D'Aprano wrote: > (Note that among strings, only the empty string counts as nothing. The > strings 'nothing', 'empty', 'false', 'not a thing', 'nada', 'not a brass > farthing', "dry as a dingo's donger" etc. are non-empty strings and > therefore count as tru

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-24 Thread Steven D'Aprano
dave wrote: Thank you for the two explanations. I think I have a good idea of what is going on now with the arguments and keyword arguments. My only remaining question is the pad_for_usrp argument. The default value is True so I thought it was a boolean and couldn't have anything to do with th

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-23 Thread Alan Gauld
dave wrote: My only remaining question is the pad_for_usrp argument. The default value is True so I thought it was a boolean and couldn't have anything to do with the "self" that was passed to it. However, I can probably puzzle that out by looking at how it's used in the code. I thought th

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-23 Thread dave
Thank you for the two explanations. I think I have a good idea of what is going on now with the arguments and keyword arguments. My only remaining question is the pad_for_usrp argument. The default value is True so I thought it was a boolean and couldn't have anything to do with the "self" that

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-22 Thread Steven D'Aprano
dave wrote: 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) This calls the ieee802_15_4_mod_pkts initializer (not a constructor -- see below) with one posit

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-22 Thread Dave Angel
On 07/22/2011 06:40 PM, dave wrote: 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 tryin