Variables and Arithmetic

July 13th, 2007

Python is a dynamically typed language. Variable names are really just labels for objects and the type can change as the program executes. Note in this example the variable “value” changes from an integer to a floating point number without complaining.

[code lang=”python”]

#variables and arithmetic

value = 5
bonus = 0.5
value = value + bonus

print value

[/code]

Running Python

July 13th, 2007

The python interpreter can be run in interactive mode from the command line. This can be pretty useful for testing, digging into data as well as heroic live coding performances.

[code]
mute@windmill:~$ python
Python 2.5.1 (r251:54863, May 2 2007, 16:27:44)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print “greetings program”
greetings program
>>> exit()
mute@windmill:~$

[/code]

Note that <ctrl>-C doesn’t work.  You need to type “exit()” or <ctrl>-D to quit the interpreter.

Normally, python apps are run by typing “python myapp.py”.  “myapp.py” is the file that contains my python application.

Some Text Sources

July 13th, 2007

As the ‘T’ in HTML indicates, there’s loads of text out there on the web. Some classic sources of (mostly) copyright free text are:

Software Links for Workshop

July 13th, 2007

First, if you haven’t already, download python:  http://python.org/download/

Now pick an editor.  Emacs, vi, etc. all work quite well and have python modes.  Personally, I really like SPE:  http://pythonide.stani.be/

Pickled Feet/Tesla Workshop

July 13th, 2007

I’m leading a workshop on creating synthetic texts using python at Tesla Berlin on July 14, 2007 as part of the Pickled Feet workshop series.  The workshop starts at about 2:00.  There’s a suggested 10 Euro donation for the program and there’s going to be a nice party/performance there in the evening as Time’s Up wrap up their residency.

About

July 9th, 2007

This blog is about generated text in art.  We’re interested in things like fake Dickens novels, unifying the theories (or at least the phrases) of Freud and Jung, rolling your own SPAM, joke machines and translating email to Rumsfeldian Newspeak, Fachjargon or Art-speak.

Links, tutorials and suggestions are gladly accepted.