is __init__py file needed ? - Python Tutorial 29

preview_player
Показать описание
is __init__py file needed ?

__init__.py file is not needed from python version 3.3 and above !!

All folders from python version 3.3 and above are considered a namespace package.
All folders from python 3.3 and above having a __init__.py file are considers a standard package.
Рекомендации по теме
Комментарии
Автор

Wow one rare video where explanation is so clear and simple, thank you, keep up the good work.

Lapchaser
Автор

Thanks for the explanation! What happens if __init__.py exists in both folders?

ryanmsnyder
Автор

finally a video that i understand. THANK YOU VERY MUCH :) :) :)

eaglei
Автор

So if I understand the __init__.py is now useless ?

FRUXT
Автор

Very good explanation in detail thanks bro

rishib
Автор

very nicely explained
Sir please clear a query .
Which type of packages resides inside site_package?

poojasuyal
Автор

So you are telling that for older versions like older than 3.3 you do not need init.py file, versus versions that are newer like python 3.12 need an init.py file? Because i find out that the newer versions are lower numbers? Can you tell me from what version on or what date they decidet to make init.py required?

halorx
Автор

What if __init__.py available on both packages?

mallikasrivastava
Автор

Your video doesn't explain what "my_package" is.

atlantic_love
Автор

It's true that in Python 3.2.0 you can't import a directory without a `__init__.py`. I built a python 3.2.0 and verify this. Thanks for the video.

tianhepeng