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?

It doesn't -- that's the right output.  What did you expect it to do?

The line "class haha(object)" says that "haha" is a class that happens to
derive from the "object" base class.  The class is still simply called
"haha", and to create an instance of the class "haha", you write "haha()".
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to