Archive:Think Python/The way of the program: Difference between revisions

wikademia>Whiteknight
m Partial (mostly) conversion from HTML to Wikitext
wikademia>Whiteknight
No edit summary
Line 308: Line 308:
are less redundant and more concise.</DD><DT CLASS="dt-description">'''literalness:'''</DT><DD CLASS="dd-description"> Natural languages are full of idiom and metaphor.
are less redundant and more concise.</DD><DT CLASS="dt-description">'''literalness:'''</DT><DD CLASS="dd-description"> Natural languages are full of idiom and metaphor.
If I say, &#X201C;The penny dropped,&#X201D; there is probably no penny and
If I say, &#X201C;The penny dropped,&#X201D; there is probably no penny and
nothing dropping<SUP>1</SUP>. Formal languages
nothing dropping<ref>This idiom means that someone realized something
after a period of confusion.</ref>. Formal languages
mean exactly what they say.</DD></DL>
mean exactly what they say.</DD></DL>
People who grow up speaking a natural language&#X2014;everyone&#X2014;often have a
People who grow up speaking a natural language&#X2014;everyone&#X2014;often have a
Line 345: Line 346:
<PRE CLASS="verbatim">print 'Hello, World!'
<PRE CLASS="verbatim">print 'Hello, World!'
</PRE>
</PRE>
This is an example of a '''print statement'''<SUP>2</SUP>, which
This is an example of a '''print statement'''<ref>In Python 3.0,
<TT>print</TT> is a function, not a statement, so the syntax is <TT>print(&#X2019;Hello, World!&#X2019;)</TT>. We will get to functions soon!</ref>, which
doesn&#X2019;t actually print anything on paper. It displays a value on the
doesn&#X2019;t actually print anything on paper. It displays a value on the
screen. In this case, the result is the words
screen. In this case, the result is the words
Line 386: Line 388:


There is evidence that people naturally respond to computers as if
There is evidence that people naturally respond to computers as if
they were people<SUP>3</SUP>. When they work well, we think
they were people<ref>See Reeves and Nass, <I>The Media
Equation: How People Treat Computers, Television, and New Media
Like Real People and Places</I>.</ref>. When they work well, we think
of them as teammates, and when they are obstinate or rude, we
of them as teammates, and when they are obstinate or rude, we
respond to them the same way we respond to rude,
respond to them the same way we respond to rude,
Line 501: Line 505:
(Hint: there are 1.61 kilometers in a mile).''
(Hint: there are 1.61 kilometers in a mile).''


''
==References ==
''
 
</DIV><HR CLASS="footnoterule"><DL CLASS="thefootnotes"><DT CLASS="dt-thefootnotes">
<references/>
1</DT><DD CLASS="dd-thefootnotes">This idiom means that someone realized something
after a period of confusion.
</DD><DT CLASS="dt-thefootnotes">2</DT><DD CLASS="dd-thefootnotes">In Python 3.0,
<TT>print</TT> is a function, not a statement, so the syntax is <TT>print(&#X2019;Hello, World!&#X2019;)</TT>. We will get to functions soon!
</DD><DT CLASS="dt-thefootnotes">3</DT><DD CLASS="dd-thefootnotes">See Reeves and Nass, <I>The Media
Equation: How People Treat Computers, Television, and New Media
Like Real People and Places</I>.
</DD></DL>
<HR>
<IMG SRC="previous_motif.gif" ALT="Previous">
<IMG SRC="contents_motif.gif" ALT="Up">
<IMG SRC="next_motif.gif" ALT="Next">