Re: [Tutor] problem with class - get message that self is not defined

2006-05-23 Thread Alan Gauld
>> self is a special varianble > "special variable" could be confusing. Python has no "special > variables". "self" is used by convention. Good point. The name self is not special it is its role that is special. thus class C: def m(s,p): print p c = C() c.m(42) Thus we define met

Re: [Tutor] problem with class - get message that self is not defined

2006-05-23 Thread Bob Gailer
Alan Gauld wrote: >> When I try to use the class listed below, I get the statement that >> self >> is not defined. >> >> test=TriggerMessage(data) >> var = test.decode(self.qname) >> >> I would have thought that self would have carried forward when I >> grabbed >> an instance of TriggerMessage. >

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Alan Gauld
> When I try to use the class listed below, I get the statement that > self > is not defined. > > test=TriggerMessage(data) > var = test.decode(self.qname) > > I would have thought that self would have carried forward when I > grabbed > an instance of TriggerMessage. self is a special varianble

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
(usually best to click reply-All so that the reply goes to the list) On Mon, 2006-05-22 at 15:08 -0400, Andrew Robert wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Well.. inside the class is the decode function. The decode method depends on "data" which is referenced as a global.

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
On Mon, 2006-05-22 at 14:28 -0400, Andrew Robert wrote: > When I try to use the class listed below, I get the statement that > self > is not defined. > > test=TriggerMessage(data) > var = test.decode(self.qname) Perhaps var = test.decode() would do

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Everyone, When I try to use the class listed below, I get the statement that self is not defined. test=TriggerMessage(data) var = test.decode(self.qname) I would have thought that self would have carried forward when I grabbed an