[Tutor] declarations

Pijus Virketis virketis@fas.harvard.edu
Sun, 7 Apr 2002 19:13:17 -0400


<HTML><HEAD>
<BASEFONT FACE=3D"Arial" SIZE=3D"2" COLOR=3D"#000000">
</HEAD>
<BODY>
<div>Cameron,<br></div>
<div>&nbsp;</div>
<div>I am definitely not an expert on the deep issues of typing,=
 because I have not done much with static type languages, and in=
 Python potential pitfalls are usually notable only by their=
 absence ... :) But the only area where advance typing is useful=
 in my experience is when you want to take advantage of some=
 method unique to a given type. Example:<br></div>
<div>&nbsp;</div>
<div>list =3D []&nbsp; &nbsp;&nbsp;# I have to make sure Python=
 knows this will be a list<br></div>
<div>list.append(&quot;a&quot;) <br></div>
<div>&nbsp;</div>
<div>There is little real advantage of saying &quot;variable =3D=
 0&quot; at the top of the program, because it seems to me there=
 is nothing preventing you from assigning a string to this=
 &quot;variable&quot; twenty lines down in Python. Or maybe I am=
 just missing the point ... :)<br></div>
<div>&nbsp;</div>
<div>Cheers, <br></div>
<div>&nbsp;</div>
<div>Pijus<br></div>
<div>-- <br></div>
<div>All bad precedents began as justifiable measures. -- Gaius=
 Julius Caesar, quoted in &quot;The Conspiracy of Catiline&quot;,=
 by Sallust <br></div>
</body></html>