Skip to content

Instantly share code, notes, and snippets.

@skelly37
Last active June 9, 2023 20:42
Show Gist options
  • Save skelly37/43747936edba57c907ae2ccd08d93943 to your computer and use it in GitHub Desktop.
Save skelly37/43747936edba57c907ae2ccd08d93943 to your computer and use it in GitHub Desktop.
Aliases for python in shell (exit, clear, get random number). Usage: `alias python = python3 -i /path/to/python_shell_aliases.py`
#!/usr/bin/python3
class Clear:
def __repr__(self):
from os import system
system("clear")
return ""
class Exit:
def __repr__(self):
exit()
class rand:
def __init__(self, start, end):
self.start = start
self.end = end
def __repr__(self):
from random import randint
return str(randint(self.start, self.end))
_ = Clear()
e = Exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment