Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
subcommands as functions
#11
(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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
(Sep-05-2018, 05:03 AM)Skaperen Wrote: how much code is needed to implement sc?
Did you read my previous post #10 ?
Reply
#13
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

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