I've made a bunch of helper functions for some data analysis work, but overtime that "bunch" has grown to quite a lot of functions. To use them, I have a huge ugly if-else branching logic for various command line arguments, but it gets tedious to maintain, as well as being annoying to have to add to the branching everytime I add a new function.
As such, I'd like to be able to make all functions that follow a certain naming schema, namely not starting with an underscore, callable via command line. To do so, I need to be able to dynamically know what functions exist, as well as what arguments they require.
Is there an easy way to do so? I saw some post on stackoverflow using an inspect module, but that required the functions to be in a different module, which is not my case.
Thanks!
Aucun commentaire:
Enregistrer un commentaire