On Apr 12, 2005 12:20 PM, Gooch, John <[EMAIL PROTECTED]> wrote: > > I have a class named 'Dir' that I want to be put into another class > 'DirList' ( essential a linked list of Dir objects ) using the 'insert()' > method. The syntax is 'DirList.insert( Dir )' which works, but then I try to > access the 'getSize()' function of the 'Dir' class from *inside* of the > DirList class, it gives me this -> > 'I added a node for dir d:/ with size <bound method Dir.getSize of > <__main__.Dir instance at 0x00E18CD8>>' > > Any ideas on what I am doing wrong? >
1) Linked lists are almost always worthless in python. Why not use a list instead? 2) what's being printed is a function reference - i.e. you're doing: self.a_dir_instance.getSize instead of: self.a_dir_instance.getSize() which actually calls the function, instead of just returning a pointer to it. Peace Bill Mill bill.mill at gmail.com _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
