Skip to content

Loading…

Add default task #1

Closed
rags opened this Issue · 2 comments

2 participants

@rags
Owner
  1. interface: @task(default=True)
  2. Only one default per module.
@BruceEckel

Definitely a nice idea, and goes along with the minimalist feel of the tool.

@rags
Owner

Although @task(default=True) looks clean, it is not the best way to specify a default task. Lot of complexity (code and interface) in ensuring only one task is specified as default. A simple check within a module to ensure there is at most 1 default task can be confusing to the user. A module with 1 default task could be imported into another module which also has only one default task defined, but the net effect is the dependent module will end up with 2 one defined in the module one imported.

A better solution is to have __DEFAULT__ variable at the end of the module which assigns the variable with function that will become the default for that module (Members with underscore prefix are not imported with import *)

@rags rags closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.