Hi, I have this code (learning from Core Python, Chun's book), module
named chap2.py.

class FooClass(object):
        version=0.1

        def __init__(self, nm='John Doe'):
                self.name=nm
                print 'Created a class instance for ', nm
        def showname(self):
                print 'Your name is', self.name
                print 'My name is', self.__class__.__name__

On Windows, if I compile this and then in the python interpreter type:

>>> import chap2
>>> foo1=FooClass()
Created a class instance for  John Doe
>>>

If I do the same think on my Mac OS X 10.5.2

NameError: name 'FooClass' is not defined.

I thought it was the path and did export PATH=$PATH:/mypath/
topythoncode

but it did not help.

What am I doing wrong?  Thank you.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to