[Tutor] meaning

Katharine Stoner kstoner@netins.net
Mon, 7 May 2001 18:12:50 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C0D721.53C0A2C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

Would someone be so kind as to explain what this bit of code means line =
by line.
Mostly I would like to know what the first four lines mean.
Thanks,
-Cameron

#!/usr/local/bin/python
def spam(n, l =3D[] ) :
    l.append(n)
    return l

x =3D spam(42)
print x
y =3D spam(39)
print y
z =3D spam(9999, y)
print x, y, z

------=_NextPart_000_000B_01C0D721.53C0A2C0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Would someone be so kind as to explain =
what this=20
bit of code means line by line.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Mostly I would like to know what the =
first four=20
lines mean.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Cameron</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#!/usr/local/bin/python</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>def spam(n, l =3D[] ) :</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
l.append(n)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; return =
l</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>x =3D spam(42)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print x</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>y =3D spam(39)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print y</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>z =3D spam(9999, y)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print x, y, =
z</FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01C0D721.53C0A2C0--