In article <mailman.1483.1356927535.29569.python-l...@python.org>, contro opinion <contropin...@gmail.com> wrote:
> here is my haha class > class haha(object): > def theprint(self): > print "i am here" > > >>> haha().theprint() > i am here > >>> haha(object).theprint() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: object.__new__() takes no parameters > > why haha(object).theprint() get wrong output? Please, when asking questions, let us know what version of python you're using. I'm guessing 2.x? In any case, the problem is that you defined a class whose constructor takes no arguments: > class haha(object): > def theprint(self): > print "i am here" You didn't define an __init__() method, so it inherits the one from the base class, object. Then here: > >>> haha(object).theprint() you try to create an instance of your class and give an argument to the constructor. -- http://mail.python.org/mailman/listinfo/python-list