470,591 Members | 2,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

inheriting type or object?

Hi folks!

As stated in subject, how do I decide wether to inherit <type 'type'> or
<type 'object'>? Whenever I want to intantiate my derived type, I taked
<type 'type'> here, but inheriting from <type 'object'> consequently would
be reasonable in cases of pure static objects (i.e. objects/types using
staticmethods exclusively), for whose I would prefer toplevel code outside
a class definition in python, since python does not oblige programmers to
use classes (like JAVA et. al.).

So, finally, my question is: Is there a design pattern, that makes
<type 'object'> a reasonable (direct) base type for new objects/types?
Right now, I can't see any.

Thank you for answering!
Greetings,
F. Sidler
Apr 27 '06 #1
1 1142
Fabiano Sidler wrote:
Hi folks!

As stated in subject, how do I decide wether to inherit <type 'type'> or
<type 'object'>? Whenever I want to intantiate my derived type, I taked
<type 'type'> here, but inheriting from <type 'object'> consequently would
be reasonable in cases of pure static objects (i.e. objects/types using
staticmethods exclusively), for whose I would prefer toplevel code outside
a class definition in python, since python does not oblige programmers to
use classes (like JAVA et. al.).

So, finally, my question is: Is there a design pattern, that makes
<type 'object'> a reasonable (direct) base type for new objects/types?
Right now, I can't see any.

Thank you for answering!
Greetings,
F. Sidler


I don't think these are the recommended usages for type and object.
Usually class factories (metaclasses) inheret from type and classes that
instantiate objects inheret from object. I think this might clear up the
issue:

http://www.python.org/download/releases/2.2/descrintro/

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Apr 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Fuzzyman | last post: by
15 posts views Thread by JustSomeGuy | last post: by
11 posts views Thread by Noah Coad [MVP .NET/C#] | last post: by
2 posts views Thread by Shayne H | last post: by
3 posts views Thread by Roy Soltoff | last post: by
24 posts views Thread by toton | last post: by
17 posts views Thread by Adrian Hawryluk | last post: by
2 posts views Thread by snorble | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.