Created
October 7, 2011 01:36
-
-
Save pzwang/1269228 to your computer and use it in GitHub Desktop.
a stab at multi-dimensional analog literals in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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