A little archaeological interest made me want to explore early Python, so I built and ran Python 1.0.1.
The oldest source code currently available from the official Python page (http://legacy.python.org/download/releases/src/) is Python 1.0.1. It was released in 1994, nearly five years after Python development began in December 1989. According to the README
Older sources
If you find an older Python release (e.g. 0.9.8), we're interested in getting a copy! [email protected]
Therefore, it seems that data has been lost in earlier versions. Speaking of 1989, there was no Git, SVN, or CVS, so there is no help for it.
Download and unzip.
$ curl http://legacy.python.org/download/releases/src/python1.0.1.tar.gz -O
$ tar xzf python1.0.1.tar.gz
$ cd python-1.0.1
The tarball contains configure
, Makefile.in
, etc., and the build procedure is exactly the same as in modern times.
However, the internally used function getline
conflicts with the modern standard library, so you need to replace the name.
$ sed -i 's/^getline/my_getline/' Objects/fileobject.c
$ sed -i 's/ getline/ my_getline/' Objects/fileobject.c
All you have to do is build as usual.
$ ./configure
$ make
Let's play with the binary file python
that came out.
$ ./python
Python 1.0.1 (Jan 11 2017)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> hex(12345678901234567890)
OverflowError: integer literal too large
>>> hex(12345678901234567890L)
'0xAB54A98CEB1F0AD2L'
>>> int('100')
Traceback (innermost last):
File "<stdin>", line 1
TypeError: int() argument can't be converted to int
>>> int(1.5)
1
>>> def fibonatti(n):
... if n == 1 or n == 2:
... return 1
... else:
... return fibonatti(n - 1) + fibonatti(n - 2)
...
>>> fibonatti(5)
5
>>> o = {'foo': 1, 'bar': 'baz'}
>>> o
{'foo': 1, 'bar': 'baz'}
>>> for i in range(5):
... print(i)
...
0
1
2
3
4
>>> range(100)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
>>> [i * 2 for i in range(10)]
/home/esolang/python: line 3: 7 Segmentation fault ./python
$
It doesn't have much functionality, but it works just like modern Python.
Recommended Posts