Python documentation says:

> exception TypeError
>
> Raised when an operation or function is applied to an object of
> inappropriate type. The associated value is a string giving details
> about the type mismatch.

For example:

>>> 'foo' + (1, 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'tuple' objects

So far so good. But why the following code gives a TypeError too?

>>> class C(object):
...     def __init__(self):
...             pass
...
>>> C(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() takes exactly 1 argument (2 given)

I'm having hard times understanding why a TypeError is raised here.
Could you explain?

Thanks.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to