codecool
codecool

Reputation: 6046

What does dry-run do in optparse Python?

What's the functionality of the dry-run option in the optparse module of Python?

Upvotes: 2

Views: 1855

Answers (2)

mac
mac

Reputation: 43061

Dry run is a generic expression in many fields, including computing, meaning that a certain operation should be performed or simulated limiting its dangerous effects.

It is up to you to associate that option to something meaningful in your code. For example: if your script normally removes files from the hard drive, the --dry-run option should only print out a list of the files that would have been deleted if the script would have been ran without the --dry-run option.

--dry-run is just a conventional name for that option, but you could implement the same functionality with any other name (e.g --simulate-only or --dont-screw-up).

Upvotes: 4

Eli Bendersky
Eli Bendersky

Reputation: 273736

--dry-run has no special meaning for the optparse module.

It is just an example used in the documentation of the module.

Upvotes: 3

Related Questions