Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss package definition file in packaging lesson #131

Open
mdpiper opened this issue Sep 8, 2023 · 2 comments
Open

Discuss package definition file in packaging lesson #131

mdpiper opened this issue Sep 8, 2023 · 2 comments

Comments

@mdpiper
Copy link
Member

mdpiper commented Sep 8, 2023

The __init__.py file defines a package and lets us do relative imports. Add a paragraph on this to packaging section of the modules lesson.

@mdpiper
Copy link
Member Author

mdpiper commented Sep 8, 2023

I almost was able to get away without talking about this, but it's needed, in particular, for relative imports.

@mdpiper
Copy link
Member Author

mdpiper commented Sep 8, 2023

From the Python Tutorial:

The __init__.py files are required to make Python treat directories containing the file as packages. This prevents directories with a common name, such as string, from unintentionally hiding valid modules that occur later on the module search path. In the simplest case, __init__.py can just be an empty file, but it can also execute initialization code for the package...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant