• Login or register

discuss.effbot.org

  • Popular
  • Recent
  • Importing Python Modules (effbot.org)
    1 point by effbot 11 months ago
    • 2 comments
  • comment deleted
    • 1 point by effbot 10 months ago 1 child

      It doesn't support file paths. It does support package names, but it doesn't really do what you expect: __import__('X.Y.Z') will indeed import the X, X.Y, and X.Y.Z modules and install them in sys.modules, but the function returns the X package module instead of the Z module.

      Also see: http://effbot.org/zone/import-string.htm

      • link
      • reply
      • 1 point by tepples 5 months ago 0 children

        "The Module Documentation Tells You To Use from-import"

        Examples of this would include everything in __future__.

        • link
        • reply
  • Widget
  • Recent Comments
  • Leaders
Powered by