Guido van Rossum schrieb:
> On Wed, Apr 2, 2008 at 3:03 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> 
> wrote:
>>  On Wed, Apr 2, 2008 at 11:57 PM, Paul Prescod <[EMAIL PROTECTED]> wrote:
>>  >  But does anyone else find it odd that the types of some things are
>>  >  classes and the classes of some things are types?
>>  >
>>  >  >>> type(socket.socket())
>>  >  <class 'socket.socket'>
>>  >  >>> type("abc")
>>  >  <type 'str'>
>>  >  >>> socket.socket().__class__
>>  >  <class 'socket.socket'>
>>  >  >>> "abc".__class__
>>  >  <type 'str'>
>>  >
>>  >  In a recent talk I could only explain this as a historical quirk. As I
>>  >  understand, it is now possible to make types that behave basically
>>  >  exactly like classes and classes that behave exactly like types. Is
>>  >  there any important difference between them anymore?
>>
>>  I can find one difference:
>>  - types are written in C
>>  - classes are written in Python
>>
>>  and there is a difference in behaviour:
>>  most types don't have a writable __dict__, and you cannot add members.
>>  classes are more flexible.
> 
> That's more correctly described as the difference between built-in
> types/classes and user-defined types/classes.
> 
> I think it's still just a historical quirk; maybe we should bite the
> bullet and fix this in py3k. (Still, 'type' and 'class' will both be
> part of the language, one as a built-in function and metaclass, the
> other as a keyword.)

+1 on the repr() change (to "class", preferably). That's exactly the kind
of simplification that Py3k is intended to make.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to