2
I’m using the class Cmd of module cmd Python to create an interpreter for a game in Text Adventure. However, I have come up with a problem regarding the words I use as methods for the interpreter to perform.
See this illustration example:
import cmd
class Comando(cmd.Cmd):
  prompt = ">"
  def do_olhar(self, valor):
    print('Olhar em volta')
  def do_ver(self, valor):
    print('Olhar em volta')
  def do_pegar(self, valor):
    print('Pegar algo')
  def do_pega(self, valor):
    print('Pegar algo')
  def do_obter(self, valor):
    print('Pegar algo')
c = Comando()
c.cmdloop()
Note that some words are similar and have the same purposes, such as obter, pegar, pega, olha, olhar and ver. 
Therefore, I would like to know if it is possible to create a method that is associated with a set of words and not just one as is the case above i.e. do_palavra()?
This method is better, I will erase my answer
– nosklo
@nosklo I think you could leave your answer, it’s good to have alternatives :)
– gato