daodejing for pythonistas I
Saturday, 16 June 2007
A value is a value
Verily it is a value
A reference is a reference
Verily it is a reference
道可道,非常道。名可名,非常名。
A value’s existence is eternal1
But we can’t handle it until a reference is created2
无名天地之始。有名万物之母。
Break out of the python interpreter,
one will grok values actually are.
But running in the interpreter,
one can never know what the true value is3
故常无欲以观其妙。常有欲以观其徼。
But a value and a reference are of the same essense4
of the strange machine we exist in5
此两者同出而异名,同谓之玄。
As mysterious a language like C is,
it’s the gateway to understanding how python works.
玄之又玄,众妙之门。
Reference: Here’s a good English interpretation of Tao Te Ching
1Particular for some integers, which are already initialized in the interpreter, or until garbage collected (but only the interpreter knows that)
2Not strictly true:
>>> import dis; dis.dis(lambda: 1+1)
0 LOAD_CONST 1 (1)
3 LOAD_CONST 1 (1)
6 BINARY_ADD
7 RETURN_VALUE
3The is operator and the id() function come pretty close, but you aren’t inspecting memory here.
4both exists in the heap of the Python VM
5Python virtual machine