father class name

88888 Dihedral dihedral88888 at googlemail.com
Tue Jan 1 03:37:40 EST 2013


On Monday, December 31, 2012 12:18:48 PM UTC+8, contro opinion wrote:
> here is my haha  class
> class  haha(object):
>   def  theprint(self):
>     print "i am here"
> 

The definition of a class named haha.

> >>> 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?

You don't have to type the base class object.



More information about the Python-list mailing list