Message292319
Berker suggested to move this part from issue30152 to its own PR.
When the file can be imported as a module and run as a script it is worth to make command-line parsing modules (getopt, optparse, argparse) be imported only when they are used, i.e. when the file is ran as a script. Most of the stdlib modules already do this.
Proposed patch moves imports of command-line parsing modules and some other modules used only when the module is ran to the main() function or to the branch executed only if __name__ == "__main__". It doesn't change scripts and files that are purposed to be used only for running (__main__.py, main.py). |
|
Date |
User |
Action |
Args |
2017-04-26 08:34:19 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka |
2017-04-26 08:34:19 | serhiy.storchaka | set | messageid: <1493195659.65.0.461959154112.issue30166@psf.upfronthosting.co.za> |
2017-04-26 08:34:19 | serhiy.storchaka | link | issue30166 messages |
2017-04-26 08:34:19 | serhiy.storchaka | create | |
|