Just found this: http://www.seebs.net/faqs/c-iaq.html - a brilliant read! :) For example:
2.2: I heard that structures could be assigned to variables and passed to and from functions, but K&R I says not.
K&R I was wrong; they hadn't actually learned C very well before writing the book. Later, Ritchie got a job at Bell Labs, and worked closely with the authors of C, allowing the 2nd edition of the book to be much more accurate. (Kernighan already worked at Bell Labs, as a video game developer.)
After a fresh install, saying:
sudo apt-get install python-zodb
..did not properly set up ZODB. Some kind of version conflict/Ubuntu bug. Had to add following lines to
deb http://ppa.launchpad.net/schooltool-owners/ubuntu hardy main deb-src http://ppa.launchpad.net/schooltool-owners/ubuntu hardy main
sudo apt-get install python-zodb sudo apt-get install python-zope.interface sudo apt-get install python-zope.proxy
Install went ok, but failed to boot to the newly installed system. Had to boot to a rescue prompt from the CD, and say:
apt-get install linux-virtual
After which it worked fine. See: https://answers.launchpad.net/ubuntu/+question/23343
import shelve, os, time, sha class Foo: def __init__(self): self.data = sha.new(repr(time.time())).hexdigest() nobjects = 100000 try: os.unlink('speedtest.db') except OSError: print "creating db file" start = time.time() db = shelve.open('speedtest') i = nobjects while i > 0: db[str(i)] = Foo() db.sync() i = i - 1 db.close() t = time.time() - start print t, " sec for ", nobjects, " objects; ", t/nobjects, " sec/object"
On a 2 GHz MacBook with 1 GB of RAM and Python 2.3.5 the run time for this program is around 7 seconds. ("7.00173902512 sec for 100000 objects; 7.00173902512e-05 sec/object", the AnyDBM backend being "Berkeley DB 1.85 (Hash, version 2, native byte-order)".) Omitting the .sync() call shaves a few hundred milliseconds from that.