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 слични објави

Пребарај: #plastics

当前筛选 #plastics清除筛选
Amazing Geography 🌍

@amazingeo · Post #30 · 10.08.2025 г., 14:31

🌍 The Great Pacific Garbage Patch is a floating area of plastic and debris in the Pacific Ocean, now estimated to be more than twice the size of Texas. It affects sea life far beyond its borders. ✨ #pollution⚡#ocean⚡#plastics⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Amazing Geography 🌍

@amazingeo · Post #570 · 11.01.2026 г., 20:31

🌍 The Great Pacific Garbage Patch, a swirling mass of plastic debris, now covers an area larger than Germany. Ocean currents trap millions of tons of waste here, creating a persistent global pollution hotspot. ✨ #pollution⚡#oceans⚡#plastics⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Crypto M - Crypto News

@CryptoM · Post #64535 · 09.04.2026 г., 06:35

🚀 U.S. March CPI Expected to Rise Amid Ongoing Iran Conflict The market widely anticipates that the U.S. Consumer Price Index (CPI) for March will increase by 3.4%, surpassing last month's 2.4%, marking the largest year-on-year rise in two years. According to Jin10, during past oil market shocks, the most likely commodities to see price hikes include aviation fuel, steel, aluminum, natural gas, fertilizers, and plastics. Industries reliant on these materials are already feeling the strain. The ongoing Iran conflict, which has lasted several weeks, has shifted concerns from the initial oil price surge to the compounded effects of a prolonged conflict. For many economists, the most alarming aspect is not the immediate issues but the "aftershocks" that may emerge months or even years later. JPMorgan's CEO has referred to inflation as a potential "fly in the ointment" that could undermine stock market returns in 2026. Harvard University professor and former IMF chief economist Ken Rogoff recently discussed an overlooked impact of the war: the increased military spending's effect on the already strained U.S. budget deficit. He noted the risk of soaring bond yields, which could harm the stock market and affect U.S. affordability. Rogoff also mentioned that the current supply disruptions caused by the Iran conflict are sufficient to keep oil prices elevated for a year. #USCPI#inflation#IranConflict#oilprices#aviationfuel#steel#aluminum#naturalgas#fertilizers#plastics#economicimpact#stockmarket#JPMorgan#budgetdeficit#militaryspending#bondyields#HarvardEconomist#supplydisruptions#USaffordability