En Thu, 31 Jul 2008 09:30:19 -0300, Nikolaus Rath <[EMAIL PROTECTED]> escribi�:

oj <[EMAIL PROTECTED]> writes:
On Jul 31, 11:37 am, Nikolaus Rath <[EMAIL PROTECTED]> wrote:
So why does Python distinguish between e.g. the type 'int' and the
class 'myclass'? Why can't I say that 'int' is a class and 'myclass'
is a type?

I might be wrong here, but I think the point is that there is no
distinction. A class (lets call it SomeClass for this example) is an
object of type 'type', and an instance of a class is an object of type
'SomeClass'.

But there seems to be a distinction:

class int_class(object):
...   pass
...
int_class
<class '__main__.int_class'>
int
<type 'int'>
[...]
If there is no distinction, how does the Python interpreter know when
to print 'class' and when to print 'type'?

If it helps you to understand the issue, in Python 3.0 that difference is gone - the word "class" is used on both cases. See http://bugs.python.org/issue2565

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to