On 22 August 2011 00:17, Dave Angel <span dir="ltr"><<a href="mailto:d@davea.name">d@davea.name</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 08/21/2011 05:35 PM, D. Guandalino wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Python documentation says:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
exception TypeError<br>
<br>
Raised when an operation or function is applied to an object of<br>
inappropriate type. The associated value is a string giving details<br>
about the type mismatch.<br>
</blockquote><br></blockquote></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote></div></div>
You didn't supply a parameter in the __init__() to receive the value of 1. The self argument is automatically supplied by Python for all ordinary method calls including initial object construction. So when you say C(1) you're actually going to get 2 arguments in the __init__() call.<br>
<br>
Add another parm to the definition:<br>
<br>
def __init__(self, startvalue):<br>
pass<font color="#888888"><br></font></blockquote><div><br>Thanks and apologies for not being clear.<br><br>I missed to say that I'm more interested in understanding which error I did with types (given that a TypeError is raised) than in fixing the code.<br>
</div></div><br>