# ```import *``` と ```__init__.py``` の ```__all__``` の関係 「[Python チュートリアル](https://docs.python.jp/3/tutorial/index.h...
seen from Germany
seen from United States
seen from United States
seen from United States
seen from Philippines

seen from United Kingdom
seen from Austria

seen from Malaysia
seen from United States

seen from Malaysia
seen from China
seen from United States
seen from United States
seen from Ukraine

seen from United States

seen from Canada
seen from Germany
seen from China
seen from Egypt

seen from Malaysia
# ```import *``` と ```__init__.py``` の ```__all__``` の関係 「[Python チュートリアル](https://docs.python.jp/3/tutorial/index.h...
__init__.py
Reference: the book - Chapter 5 of Introducing Python
boxes -|-- weather.py |-- sources --|-- __init__.py |-- daily.py |-- weekly.py
If the folder contains __init__.py file, Python would treat it as a package.
For this example, sources is a pacakge and it contains the two modules: daily and weekly.
An example to use the package you created:
Main program: boxes/weather.py.
from sources import daily, weekly print("Daily forecast:", daily.forecast()) print("Weekly forecast:") for number, outlook in enumerate(weekly.forecast(), 1): print(number, outlook)
This is hopefully the first in a series of posts about writing Pythonic code and explaining some common Python idioms.
Files named __init__.py are used to mark directories on disk as a Python package directories.
Use __new__ when you need to control the creation of a new instance. Use __init__ when you need to control initialization of a new instance. __new__ is the first step of instance creation. It's called first, and is responsible for returning a new instance of your class. In contrast, __init__ doesn't return anything; it's only responsible for initializing the instance after it's been created. In general, you shouldn't need to override __new__ unless you're subclassing an immutable type like str, int, unicode or tuple.