Class problem
Michael T. Babcock
mbabcock at fibrespeed.net
Mon Dec 8 12:49:00 EST 2003
> Hello. I'm currently trying to create my first class in python, but
> I've ran into a bit of a problem which I fear may just be a simple
> error. I created a class called ImagePyramid.py which currently only
> contains an _init_ method which takes in 2 parameters and performs a
> bunch of things using these parameters. I believe I've followed the
> tutorial correctly, but when I import it and try to make an instance
> of it, it returns with the error that 'module' is not callable. I'm
> kind of new to this language so I believe that it's most likely a
> simple error on my behalf. Any advice on what I may be doing wrong
> would be greatly appreciated.
In the future, please actually post your code with your questions.
However, I'll guess you did something like:
class foo:
def __init__(self, params):
print "hello"
foo()
... when in reality you need to create an object of type foo ...
a = foo() <-- prints "hello"
--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock
More information about the Python-list
mailing list