Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в Python 3.3
Что он означает?
Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py.
Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета".
Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта.
Конечно, не любую в файловой системе, а только те что находятся в sys.path.
Это значит, что теперь __init__.py нужно делать только если:
🔸 вам требуется создать код инициализации пакета
🔸 нужна совместимость со старыми версиями Python
На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего.
Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов.
repo_name/
my_library/
__init__.py
main.py
examples/
exam1.py
exam2.py
В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет.
Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет!
#basic#pep
⚡️🇷🇺🇺🇦⚔️Fiend Reports in the Morning of 6 March 2025⚡️
🔴#Kursk Region:
🔴In Sudzhansky district, Russian troops continue attacks from the area of the #NikolayevoDaryino settlement in the direction of #Sumy region, assaulting the area of the #Lebedevka and #NovayaSorochina settlements.
🟡 At #Kurilovka, they have advanced in the eastern part of the 'Kholodny Yar Ravine' and on the southern outskirts of the settlement.
🗺 Map
➡️ The situation remains difficult (for the AFU).
🔴#Svatovo Front:
🔴 In #Kupyansk and #Liman directions, the situation has not changed significantly.
🔴#ChasovYar Direction:
🔴In #Toretsk Sector, fighting is taking place for the northern outskirts of the city and the southwestern part of the 'Zabalka Microdistrict.' The situation remains dynamic.
🔴#Pokrovsk Direction:
🔴 On the right Flank, fighting of varying intensity continues in the areas of the #ZelyonoyePole, #Baranovka, #Shevchenko, #Peschanoye and #Kotlino villages...
🔴 On the left Flank, for #Udachnoye and #Uspenovka.
🔴#Komar Direction:
🔴In #Kurakhovo Sector, the RFAF reduced the number of attacks by infantry units and began to restore and accumulate forces and resources.
📋Reported on 6 Mar at 08:16
🕰GMT+3; #smo
🇺🇦Map📍
📱For the Military Hardcore
💬 Welcome to Military Chat
⚡️🇷🇺🇺🇦⚡️ Two Majors #Summary for the Morning of 10 March 2025; 06:39 (GMT+3)⚡️
🔹 In #Kursk Region, in two full days of large-scale Russian Army offensive operations, significant gains have been achieved.🗺🎬👆Liberated settlements include #MalayaLoknya, #Loknya, #Nikolsky, #Lebedevka, #Kositsa, #Pravda, #Martynovka, #Kubatkin, #Viktorovka, #StarayaSorochina, and #CherkasskoyePorechnoye. This morning, reports confirmed the capture of #Makhnovka near #Sudzha, where retreating enemy forces are regrouping. Fighting is ongoing on the outskirts of #Sudzha. Several settlements were seized thanks to a 'pipeline manoeuvre - Russian assault units advanced over 15 km in a narrow space, emerging behind enemy lines and engaging in battle, causing panic. Until reinforcements arrived, assault groups fought encircled, awaiting a breakthrough. #Novenkoye in the #Sumy region has also been captured, roads are under fire control, and bridges have been destroyed to prevent enemy retreat. The objective is not to push AFU forces back but to annihilate them. This decisive push, combined with prolonged preparation and intense combat, has yielded significant results, marking the beginning of an operation that will go down in history.
🛡 Several UAVs were destroyed or suppressed in two districts of the Voronezh region overnight. Explosions were reported in #Novokuybyshevsk, #Samara region. Russian forces targeted a gas distribution station near #Lucerna (north of #Zaporozhye) with Geran drones. Additional explosions were reported in the #Kiev and #Dnepropetrovsk regions.
🔹 North and South of #Kupyansk, on the western bank of the Oskol River, AFU is urgently reinforcing positions westward in response to Russian foothold expansion.
🔹 In #Toretsk, the enemy continues sending personnel and equipment through gaps in Russian defences, only to end up surrounded and facing superior Russian forces.
🔹 Near #Pokrovsk, Russian troops are engaged in combat with counterattacking AFU units near #Peschanoye and #Shevchenko, with villages frequently changing hands.
🔹 West of #Kurakhovo, #Konstantinopol has been captured, confirmed by multiple videos showing Russian troops raising flags in different parts of the settlement.
🔹 On the #Zaporozhye Front, Russian forces continue fierce battles for #Pyatikhatki and advance towards #Shcherbaki. Air support is assisting infantry by striking enemy positions. Reports also indicate progress towards #Danilovka, north of #Rabotino.
💥 In #Belgorod Region, Ukrainian forces continue attacks on civilians. In the #Balka hamlet, two UAVs destroyed a private house by fire. In #Zhelobok, a drone struck a parked civilian vehicle. In the Valuysky district, a drone strike set a car ablaze in the settlement of #Dalny. In the village of #Borki, an FPV drone detonated within a private residence. In Grayvoron district, a drone targeted a commercial facility in #Golovchino. In #Shebekino, a man was injured by a detonated 'Kolokolchik' mine nearby.
💬Welcome to Military Chat;
🇬🇧Battle Maps
📱 Join GLOBAL DEPTH to boost your TG Feed
GLOBAL DEPTH from #HK
This channel aims to unite interested individuals from around the world in an attempt to connect the dots. Subscriber participation is always welcome here and in the channel's Chat Group.