By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,909 Members | 1,996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,909 IT Pros & Developers. It's quick & easy.

Diff. between Class types and classic classes

P: n/a
Hi,
can some one properly explain the differences between class types and
classic classes? ... Still face problems in identifying what is what.

Nov 8 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
venk wrote:
Hi,
can some one properly explain the differences between class types and
classic classes? ... Still face problems in identifying what is what.


I'm not sure I understand your question. Are you talking about the diff
between old-style and new-style classes, or the diff between classes and
metaclasses ?

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Nov 8 '05 #2

P: n/a
bruno at modulix wrote:
venk wrote:
Hi,
can some one properly explain the differences between class types and
classic classes? ... Still face problems in identifying what is what.

I'm not sure I understand your question. Are you talking about the diff
between old-style and new-style classes, or the diff between classes and
metaclasses ?

"new" classes inherit from object. Classic classes do not.
"new" classes have a __new__ method. Classic classes generally do not.
The type of a "new" class is types.TypeType
The type of a classic class is a classobj
The type of an instance of a "new" class is the name of the class
The type of an instnce of a classic class is an instance

This is shown below:
class A(object): .... def __init__(self):
.... pass
.... a= A()
class B: .... def __init__(self):
.... pass
.... b= B()
type(A) <type 'type'> type(a) <class '__main__.A'> type(B) <type 'classobj'> type(b) <type 'instance'>


I hope that this helps.

Colin W.
Nov 8 '05 #3

P: n/a
Colin J. Williams a écrit :
bruno at modulix wrote:
venk wrote:
Hi,
can some one properly explain the differences between class types and
classic classes? ... Still face problems in identifying what is what.
I'm not sure I understand your question. Are you talking about the diff
between old-style and new-style classes, or the diff between classes and
metaclasses ?

"new" classes inherit from object. Classic classes do not.

(snip)
I hope that this helps.


Colin,

I don't personaly need much help with this !-) In fact, your answer is
almost the same as the one I was going to post - before I re-read the
OP's question. And I'm still not sure that what the OP is looking for.
Nov 9 '05 #4

P: n/a
Bruno Desthuilliers wrote:
Colin J. Williams a écrit :
bruno at modulix wrote:
venk wrote:

Hi,
can some one properly explain the differences between class types and
classic classes? ... Still face problems in identifying what is what.


I'm not sure I understand your question. Are you talking about the diff
between old-style and new-style classes, or the diff between classes and
metaclasses ?

"new" classes inherit from object. Classic classes do not.


(snip)

I hope that this helps.

Colin,

I don't personaly need much help with this !-) In fact, your answer is
almost the same as the one I was going to post - before I re-read the
OP's question. And I'm still not sure that what the OP is looking for.

Bruno,

Sorry, my reponse should have been addressed to venk.

Colin W
Nov 9 '05 #5

P: n/a
Dear Colin,
Forgive me for this late reply. Your explanation was of great help to
me.
Thank you very much. It was crystal clear.

Nov 11 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.