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

Резултати

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

Пребарај: #oildependency

当前筛选 #oildependency清除筛选
Crypto M - Crypto News

@CryptoM · Post #65289 · 12.04.2026 г., 14:45

🚀 Trump Discusses Middle East Oil Dependency and NATO Spending U.S. President Donald Trump, in an interview with FOX News on April 12, expressed surprise over Japan's heavy reliance on Middle Eastern oil, with 93% of its supply coming from the region. According to BlockBeats, Trump highlighted that Japan and South Korea depend on the Middle East for 45% of their employment, yet they have not assisted the U.S. in return. He noted the presence of 45,000 and 50,000 U.S. troops in these countries, respectively, emphasizing the protection provided by the U.S. Trump criticized the lack of support from these nations and NATO when the U.S. sought assistance, mentioning that nearly a trillion dollars were spent on NATO in a short period. He predicted that oil prices would eventually decrease, although not immediately, and pointed out the stock market's performance, with the Dow Jones reaching 50,000 points in his first year in office, a milestone initially expected to take four to five years. Despite lower-than-expected gasoline price increases, Trump stressed the importance of preventing certain groups from acquiring nuclear weapons, regardless of potential price hikes. #Trump#MiddleEast#OilDependency#NATO#Japan#SouthKorea#USMilitary#StockMarket#GasPrices#NuclearWeapons

Crypto M - Crypto News

@CryptoM · Post #65115 · 11.04.2026 г., 03:35

🚀 Global Economy's Oil Dependency Declines Since 1970s, Bank of America Reports On April 11, Jin10 reported that a Bank of America research note dated April 10 highlighted a significant reduction in the global economy's dependency on oil since the 1970s. According to Jin10, the amount of oil required to produce the same scale of GDP today is only one-third of what was needed in the 1970s. The OPEC crisis and subsequent oil shocks were once considered severe stagflation events. However, the current economy is more resilient to similar energy shocks. #GlobalEconomy#OilDependency#BankOfAmerica#OPEC#EnergyShocks#Stagflation#GDP#OilCrisis#EconomicResilience