import help
Scott David Daniels
scott.daniels at acm.org
Mon Apr 10 22:54:47 EDT 2006
placid wrote:
> I have the following class code for a Node for a Linked List, (saved in
> node.py)
>
> class Node :
> def __init__(self,element):
> self.element = element
> self.next = None
>
> then i have another module called LinkedList.py, with following code
>
> import sys
> import node
> def main():
> print "Does nothin ATM, as it doesnt work"
> main()
>
> the problem im having is that im getting NameError exception when i run
> LinkedList.py "global name 'Node' is not defined"
>
> Does anyone know what the problem is here?
I have trouble believing you. I suspect you are telling us what you
think is happening, and leaving something vital out. In particular,
cut and paste the traceback.
Here's another experiment, interactively do:
import node
print node.__file__
Perhaps that will tell you something.
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list