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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #303 · 27 дек.

Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения os.getenv(NAME) И её "сестра" для создания или изменения переменных окружения os.putenv(NAME, VALUE) Но почему-то putenv() не работает как должно. Энвайромент не обновляется! os.putenv('MYVAR', '1') print(os.getenv('MYVAR')) ... и ничего 😴 Почему так? На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ. Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get() В то время как putenv() это built-in С-функция. Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет. В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__(). То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так: >>> os.putenv('MYVAR', '123') >>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"') 123 Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ. Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы. Итого ▫️ Удобней всего явно обновлять переменные через os.environ ▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать! ▫️os.environ это просто обертка для built-in функций putenv() и unsetenv(). #basic

Hashtags

Резултати

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

Пребарај: #ratecut

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

@CryptoM · Post #64951 · 10.04.2026 г., 12:07

🚀 Fed's Daly: Rate Hike Less Likely Than Cut or Hold San Francisco Federal Reserve President Mary Daly stated that the likelihood of an interest rate hike is lower compared to the possibility of a rate cut or maintaining the current rates. According to Jin10, Daly's comments reflect the ongoing assessment of economic conditions and monetary policy adjustments. The Federal Reserve continues to monitor various economic indicators to determine the appropriate course of action for interest rates. Daly's remarks suggest a cautious approach towards monetary policy amid evolving economic dynamics. #FederalReserve#InterestRates#MonetaryPolicy#Economy#USEconomy#RateHike#RateCut#EconomicOutlook

Crypto M - Crypto News

@CryptoM · Post #65351 · 13.04.2026 г., 01:57

🚀 Barclays Analysts: Asian Central Banks Likely to Maintain Monetary Policy Amid Middle East Conflict On April 13, Barclays Bank's fixed income, foreign exchange, and commodities research team released a report suggesting that Asian central banks may keep their monetary policies unchanged in the short term due to ongoing Middle East conflicts. According to Jin10, the analysts noted that the Monetary Authority of Singapore is likely to maintain its current policy this week, expressing concerns over the risks of extreme negative growth rather than inflation. Meanwhile, Barclays believes that unless the U.S. dollar significantly depreciates against the Indonesian rupiah before the upcoming Bank Indonesia meeting, the Indonesian central bank is unlikely to quickly resume its rate-cutting cycle. Additionally, the central banks of Thailand and the Philippines, which are also holding meetings this month, are expected to remain on hold. #Barclays#AsianCentralBanks#MonetaryPolicy#MiddleEastConflict#Singapore#Indonesia#Thailand#Philippines#InterestRates#BankIndonesia#USdollar#Rupiah#RateCut