In bash, you can give the alias command, for example:
alias e=echoset alias e="echo blah"
I want to know how to do the same in Python. I know that you can give class aliases, but when I try to give a command (for example, a print expression) an alias, I get an error:
>>> p = print File "<stdin>", line 1 p = print ^ SyntaxError: invalid syntax
I can do it:
p = "print" exec(p)
But this is not the same as smoothing, and I can not give any input to the command.
Update: @atzz You guessed it wasn’t like to print. I am trying to find a job:
The intention is to install the command, but instead it just beeps when I enter this:
>>> beep = Popen(['play', '-q', '/home/Username/Mich/Sound Effects/Beeps/beep-17-short.ogg'])
Then, when I enter a beep into the tooltip, it shows this:
>>> beep <subprocess.Popen object at 0x9967b8c>
But besides that, I have this problem, at least now I know that you cannot give aliases to operators.
source share