Question about import

  • Thread starter Kevin MacKenzie
  • Start date
K

Kevin MacKenzie

I'm a complete newbie to using Python. I have a small question about
importing modules.

Is there any difference between the two following statements, and what
(if any) are they?


and


Thanks.

kjm
 
T

Tim Rowe

I'm a complete newbie to using Python. I have a small question about
importing modules.

Is there any difference between the two following statements, and what
(if any) are they?



and

Yes. As I said to someone else hereabouts not all /that/ long ago
(!), is the computing equivalent to getting your toolkit out of the
cupboard and putting it on your workbench.
is the computing equivalent of getting your toolkit out of the
cupboard, tipping the contents onto the workbench, and putting the box
back into the cupboard.

If "Module" contains "foo()", means that you can call Module.foo()
means that you can use foo(). But if your code or any other module
contains something called "foo()" then you get a name clash. That can
be nasty, because you can get everything working fine, and somebody
using a library that's supposed to be compatable with the one you've
tested finds it doesn't work.

For all but the very simplest of code, use
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top