[EMAIL PROTECTED] a écrit :
<OT>
bieffe, please, learn to snip irrelevant material...
</OT>
On 9 Ott, 17:43, harijay <[EMAIL PROTECTED]> wrote:
(snip)
NameError: name 'master' is not defined"

(snip)

#File runner.py
#!/usr/bin/python
import master
import child

if __name__=="__main__":
        print "RUNNING RUNNER"
        m = master.master("hj","oldhj")
        s = child.child(m)
(snip)
#File child.py
class child():
        def __init__(self,master):
                print "Master  name is %s" % master.name
                print  "Now seeting master name to setnameinchild in child.py "
                tmp = master.trash
                master.trash = master.name
                master.name = "setnameinchild"
(snip)

You need to have an import master in child.py too.

Nope. The 'child' class is passed a 'master' instance when instanciated. You got confused by the bad naming.

<OP>
The convention in Python is to name classes in CamelCase. Your classes should be named 'Master' and 'Child'.
</OP>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to