Humor: The Evolution of a Programmer

Erik Price erikprice at mac.com
Tue Nov 12 22:19:33 EST 2002


On Tuesday, November 12, 2002, at 08:15  PM, bscott at ntisys.com wrote:

> On Tue, 12 Nov 2002, at 10:08pm, sconce at in-spec-inc.com wrote:
>> Python hacker
>>
>> 'Hello, world.'
>
>   Transcript of my shell session:
>
> 	$ cat > hw.py
> 	'Hello, world.'
> 	^D
> 	$ python hw.py
> 	$
>
>   What did I do wrong?

A literal string in a Python program doesn't do anything, just like 
with most languages.  I think that the OP was referring to the Python 
interactive prompt, wherein a name by itself is evaluated (and a 
literal string evaluates to a literal string).  Here is an example:

wintermute:~$ python
Python 2.2 (#1, 07/14/02, 23:25:09)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> 'hello world'            # string literal all by itself
'hello world'                   # evaluated
 >>> hw = 'hello world'
 >>> hw                        # variable name all by itself
'hello world'                   # evaluated
 >>>

But you're right, the simple presence of either a literal string or a 
name won't do anything in an executed python script unless you feed it 
to print() or something.



Erik





--
Erik Price                                   (zombies roam)

email: erikprice at mac.com
jabber: erikprice at jabber.org




More information about the gnhlug-discuss mailing list