Python Forum

Full Version: subcommands as functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Sep-03-2018, 04:19 AM)Gribouillis Wrote: [ -> ]So you prefer
def sc_bacon():
    ...
over
@sc
def bacon():
    ...
However, the latter is more powerful and you don't have to write the code that extracts the subcommands from the global namespace.

yes. and one big reason is this decision is made without knowing what sc is or what it does. how much code is needed to implement sc? can you show that code, too?
(Sep-05-2018, 05:03 AM)Skaperen Wrote: [ -> ]how much code is needed to implement sc?
Did you read my previous post #10 ?
Also, to return the discussion back to the roots - my suggestion to use click... You can always check the source code for the decorators used:
https://github.com/pallets/click/blob/ma...orators.py
Pages: 1 2