Python Forum
now i wish Python had a way to add commands
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
now i wish Python had a way to add commands
#4
(Dec-26-2021, 08:56 PM)Jeff900 Wrote: maybe there is a way to further implement such functionality?

how i would design such a thing is have a way to register a new command for the internal command table with a reference to the function to be called when that command is to be run. this could also be done as a special dictionary indexed by command name strings with values being the function to call. the command line would be passed to that function some way (yet to be defined).

def boom():
    exit('**** BOOM ****')
__command_table__['die'] = boom
die
that's just an overly simplistic example.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: now i wish Python had a way to add commands - by Skaperen - Dec-26-2021, 11:35 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020