Skip to content

Instantly share code, notes, and snippets.

@pzwang
Created October 7, 2011 01:36
Show Gist options
  • Save pzwang/1269228 to your computer and use it in GitHub Desktop.
Save pzwang/1269228 to your computer and use it in GitHub Desktop.
a stab at multi-dimensional analog literals in Python
>>> I = 1
>>> t = 1
>>> ( +~~~~~~~~+
... I |
... +~~~~~~~~t )
1
# You can also do 3D analog literals. It is not quite as nice as in C/C++
# because none of python's unary math operators resemble a vertical ASCII art
# element.
# The following is perfectly valid Python.
I = L = o = 1
print(+---------o
|L \
| L \
| L \
| +---------o
| - I
| - I
| - I
| - I
+ - I
+ - I
+- I
+---------o )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment