Why Nostr? What is Njump?
2024-05-08 10:57:34

scy on Nostr: Imports in Python can be confusing. I just saw someone ask "why do I have to prepend ...

Imports in Python can be confusing.

I just saw someone ask "why do I have to prepend a dot to import a file in the same directory?"

That depends on whether the file with the import statement is in a package or not.

But, whether Python considers it to be in a package depends on how you imported (or ran) _that_ file. You can't determine it from the file's content or the filesystem structure!

Check alt text (image description) for explanations of the examples.

#Python #import




Author Public Key
npub15pc5vt5kqgr60g389gl4n5zzuktz8wezz76klym9ew3puy3p8clqckhvce