Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • The latter is the preferred method. The form containing the as keyword is primarily for importing and renaming the module in one line. e.g. import somemodule as mymodule. Commented Jan 27, 2013 at 19:34
  • Yeah, I figured it might be something like this. I guess because I mainly coded in Java so far I'm used to not having to specify the full path to something after it has been imported... Commented Jan 27, 2013 at 19:50
  • @Cakejoke: You don't have to specify the full path, if you import it in the right way. There are different forms of the import statement to let you choose which way you want to refer to the imported items. Commented Jan 27, 2013 at 19:59
  • True, but again, being from a Java environment I'm used to a simpler importing syntax. Still, that probably makes Python a little bit more flexible when dealing with multiple modules of the same name. Commented Jan 27, 2013 at 20:06