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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #32 · 7 фев.

Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks

Резултати

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

Пребарај: #goldprice

当前筛选 #goldprice清除筛选
FXStreet Crypto News

@fxstreetcrypto · Post #53473 · 23.03.2026 г., 13:39

🎲What if Gold is no longer the safe haven you think it is? Geopolitical storm brewing 🌩 US vs Iran. Strait of Hormuz. Oil surging. Inflation creeping back. And markets? Cracking. 📉 S&P 500: 4 losing weeks straight 🥈Silver -10% and falling ₿ BTC under $70K | $300M wiped in a day 🥇Gold breaking support, $3,870 in sight? The FXStreet team breaks it ALL down. Levels, catalysts, what comes next. 🔍 👉Watch before the next move happens. https://www.youtube.com/watch?v=rjhGCvZ95QI #GoldPrice#MarketAnalysis#GeopoliticsNews

Crypto M - Crypto News

@CryptoM · Post #64929 · 10.04.2026 г., 10:26

🚀 PRECIOUS METALS | Long-Term Gold Rebound Anticipated Amid Middle East Conflict Gold is expected to experience a long-term rebound despite the current market disruptions caused by the Middle East conflict, according to financial institutions such as ANZ Banking Group and Goldman Sachs. Bloomberg posted on X, highlighting that these banks foresee a recovery in gold prices as geopolitical tensions continue to influence market dynamics. The ongoing conflict has introduced volatility, but experts believe that gold's status as a safe-haven asset will support its value in the long run. Investors are advised to consider the potential for gold's resurgence as part of their strategic planning. #PreciousMetals#GoldRebound#MiddleEastConflict#SafeHaven#GeopoliticalTensions#MarketVolatility#GoldPrice#Investing#FinancialInstitutions

Crypto M - Crypto News

@CryptoM · Post #65334 · 13.04.2026 г., 00:14

🚀 PRECIOUS METALS | Global Central Bank Gold Purchases Show Resilience, Citic Securities Reports Citic Securities has released a report indicating that the global trend of central banks purchasing gold remains structurally resilient. According to Jin10, the market may be overestimating the driving forces and impact mechanisms behind this trend. The report outlines several key points: 1) The proportion of non-standard channels and domestic storage in gold purchases is rising, reflecting the strengthened attribute of gold as a 'sovereign safe asset.' 2) The current wave of gold buying goes beyond conventional reserve management and should not be directly equated with de-dollarization. The primary logic for central banks holding gold remains crisis hedging and reserve diversification. 3) Recent disturbances, such as temporary reductions by central banks in Turkey and Russia due to fiscal pressures, are tactical and do not alter the global net buying pattern. 4) Central bank gold purchases are a long-term force elevating the gold price center, but their behavior of buying on dips means they play more of a supporting role. Variables like real interest rates have a more significant impact on gold prices. 5) The gap in gold reserve proportions between emerging market central banks and developed countries is substantial, indicating that the current cycle of central bank gold purchases is far from over. Citic Securities is optimistic about medium to long-term allocation opportunities but advises monitoring signals of weakened correlation between gold and risk assets in the short term as a key entry point for buying on dips. #PreciousMetals#Gold#CentralBank#GoldPurchases#SafeAsset#ReserveDiversification#EmergingMarkets#GoldPrice#Investment#FinancialMarkets