Re: Access from one class to methode of other class
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Access from one class to methode of other class

From: bruno modulix <onurb@xiludom.gro>
Date: Thu May 26 2005 - 17:56:36 CEST

VK wrote:
>> I don't know if your're actually calling the classes '1' and '2', but
>> that's a really bad idea!
>>
>>
>>> class 2:
>>> def ins(self)
>>> d.entry.insert(variable)
>>
>>
>>
>> This is probably where you're getting the NameError. d is not defined,
>> so calling d.entry will generate an error.
>>
>
> What is d = 1() in my example then?

a global variable.

> And how do I solve this problem?

passing d to the instance of 2 *could* be a solution.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb@xiludom.gro'.split('@')])"
Received on Thu Sep 29 16:14:24 2005