TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #197 · 4 јан.

Подразумеваемые неймспейсы или неявные пакеты. Этот функционал добавлен в 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

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #tff

当前筛选 #tff清除筛选
Кино и 🍋🍋

@monica_vittti · Post #3633 · 03.12.2025 г., 15:23

Антонио Бандерас, Жюльет Бинош, Александр Сокуров, Дольф Лунгрен и Спайк Ли на кинофестивале в Турине #tff

Hashtags

Кино и 🍋🍋

@monica_vittti · Post #2596 · 04.09.2024 г., 08:52

„Быть знаменитым — всё равно, что сидеть на сахарном троне во время проливного дождя» — Марлон Брандо. Ему посвящена ретроспектива и афиша кинофестиваля в Турине, который пройдет 22-30 ноября. Всего планируется к показу 24 фильма с его участием #tff #великаякрасота

Та самая Beisheeva 📸

@beisheevaaa19 · Post #2264 · 24.02.2025 г., 13:51

Central Asia bids to host AFC Asian Cup 2031: historic bid from Tajikistan, Uzbekistan and Kyrgyzstan Following the invitation from the Asian Football Confederation (AFC) to its Member Associations to submit bids for hosting the prestigious AFC Asian Cup 2031™ Finals, the Football Federation of Tajikistan, the Uzbekistan Football Association, and the Kyrgyz Football Union have officially expressed their joint interest in hosting the prestigious tournament. Over the years, the AFC Asian Cup™ has evolved into one of the premier global sporting event, bringing together the best footballing talent from across Asia and showcasing the unwavering passion of fans from every corner of the continent. More than just a competition, the tournament serves as a catalyst for football development, offering the host nation(s) a platform to enhance sporting infrastructure, boost grassroots participation, and elevate football to new heights. The decision by the three member associations of CAFAto submit a joint Expression of Interestmarks a significant milestone in the region's footballing ambitions. If selected, this would be the first time in history that the AFC Asian Cup™ Finals would be hosted in Central Asia, underscoring the rapid footballing growth and commitment of the region to advancing the sport. A joint bid from Tajikistan, Uzbekistan, and Kyrgyz Republic represents a unique opportunity to: • Unite the region through football and strengthen sporting ties across Central Asia. • Leverage world-class venues and infrastructure to deliver an unforgettable tournament. • Inspire a new generation of footballers and provide long-term benefits for grassroots development. • Showcase Central Asia’s cultural and sporting heritage the world. Speaking on the bid, CAFA President H.E. Rustam Emomali stated: “The AFC Asian Cup is more than a football tournament—it is a celebration of unity, progress, and sporting excellence. Central Asia has a deep-rooted football culture and a passionate fan base, and we are confident that together, Tajikistan, Uzbekistan, and Kyrgyz Republic can deliver an exceptional tournament that leaves a lasting legacy.” #AFC#UFA#KFU#TFF#unity#centralasia