diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-16 22:42:17 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-16 22:42:17 -0500 |
| commit | a05f7822b10ed4cdd61ed8384299a003baf1c1c6 (patch) | |
| tree | 28ec9e0efa0cb5c7f335579271c61a2f910680f9 /python/mal_readline.py | |
| parent | b3402a82d38d0d59b91b117005c6bef2748acf8b (diff) | |
| download | mal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.tar.gz mal-a05f7822b10ed4cdd61ed8384299a003baf1c1c6.zip | |
Python: metadata on builtin funcs. Support python3.
Diffstat (limited to 'python/mal_readline.py')
| -rw-r--r-- | python/mal_readline.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/mal_readline.py b/python/mal_readline.py index e8cf957..2add6b5 100644 --- a/python/mal_readline.py +++ b/python/mal_readline.py @@ -1,7 +1,11 @@ -import os, readline as pyreadline +import os, sys, readline as pyreadline history_loaded = False histfile = os.path.expanduser("~/.mal-history") +if sys.version_info[0] >= 3: + rl = input +else: + rl = raw_input def readline(prompt="user> "): if not history_loaded: @@ -15,7 +19,7 @@ def readline(prompt="user> "): pass try: - line = raw_input(prompt) + line = rl(prompt) pyreadline.add_history(line) with open(histfile, "a") as hf: hf.write(line + "\n") |
