>> 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
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.
>
> 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
(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.
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
-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