logoalt Hacker News

swiftcoderyesterday at 9:04 PM1 replyview on HN

Is that not the purpose of the global switch outlined in the PEP?


Replies

cgriswaldyesterday at 10:06 PM

No. From the PEP:

  Where <mode> can be:
  
      "normal" (or unset): Only explicitly marked lazy imports are lazy
      "all": All module-level imports (except in try blocks and import *) become   potentially lazy
      "none": No imports are lazy, even those explicitly marked with lazy keyword

  When the global flag is set to "all", all imports at the global level of all modules are potentially lazy except for those inside a try block or any wild card (from ... import *) import.