On Wed, May 29, 2013 at 11:04 PM, Brett Cannon <br...@python.org> wrote: >> with initialise_module(name) as m: >> # Module initialisation code goes here >> # Module is rolled back if initialisation fails > > But you're not initializing the module; more like getting the module, either > new or from sys.modules. But I thought ModuleGetter seemed too Java-like. > Could hide the class behind a get_module function though.
The point is to provide a useful mnemonic for *why* you would use this context manager, and the reason is because the body of the with statement is going to initialize the contents, and you want to unwind things appropriately if that fails. initializing_module is probably a better name than initialized_module, though (since it isn't initialized yet on entry - instead, that's what should be the case by the end of the statement) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com