[Tutor] What is object()

Daniel Ehrenberg littledanehren at yahoo.com
Thu Jan 22 19:06:41 EST 2004


--- Hameed Khan <hameedkhaan at yahoo.com> wrote:
> hi,
>   i was reading library refrence manual. there i
> found
> object() function. they says in library refrence
> that 
>         "Return a new featureless object. object()
> is
> a base for all new style classes. It has the methods
> that are common to all instances of new style
> classes." 
> 
> My questions are whats the use of this function and
> the object returned by it? and what are new style
> classes?.
> 
> Thanks,
> Hameed Khan

Object is not a function, Python just makes classes
look somewhat like functions. When you call object(),
you're really making an instance of the object class.
This is pretty useless because you cannot change
anything in it. However, it is very useful to subclass
object when making a class, because then you get some
of the more advanced things in object orientation
(like mro(), new-style inheritance, etc.).

Daniel Ehrenberg

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



More information about the Tutor mailing list