Create a gist now

Instantly share code, notes, and snippets.

@eosrei /cpy
Last active Dec 15, 2015

What would you like to do?
Using Python 3 as a screen-logging command-line calculator
#!/usr/bin/env python3
# Save this in your ~/bin as `cpy` and chmod +x
import code
import readline
import rlcompleter
# Directly import all the math functions
from math import *
print("Interactive Python 3 with 'from math import *'")
vars = globals()
vars.update(locals())
readline.set_completer(rlcompleter.Completer(vars).complete)
readline.parse_and_bind("tab: complete")
shell = code.InteractiveConsole(vars)
shell.interact()
Owner

eosrei commented Dec 15, 2015

List of functions available in math: https://docs.python.org/3/library/math.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment