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

Резултати

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

Пребарај: #westerncrisis

当前筛选 #westerncrisis清除筛选
New Eastern Outlook

@neweasternoutlook · Post #11800 · 06.01.2026 г., 14:01

🌐🌎Why will the international system enter an irreversible post-Western phase in 2026, and why? The year 2026 marks a geostrategic tipping point where the "American Century" definitively collapses, superseded by a sovereign Eurasian pole and a Global South liberated from the dollar's stranglehold and Bretton Woods institutions ✍️Author:Mohamed Lamine KABA Expert in geopolitics of governance and regional integration, Pan-African University ➡️The West's doctrine of containment has failed spectacularly. NATO's expansion, intended to subordinate Eurasia, has instead reawakened Russian strategic power and resilience. Europe, held hostage to this strategy, is committing industrial suicide by severing itself from Russian energy, leading to deindustrialization and wealth transfer to the US and Global South. The Franco-German industrial core is crumbling under prohibitive energy costs, while Brussels remains paralyzed by bureaucratic dogma like the Green Deal, reducing the EU to a servile entity in a multipolar world. ➡️Simultaneously, the Global South is breaking its chains. The unprecedented freezing of Russian assets in 2022 shattered trust in the Western financial system, triggering active de-dollarization. By 2025, this became an infrastructural reality: oil and mining transactions now bypass SWIFT, conducted in local currencies or via the BRICS+ payment system. Russia, resilient against total sanctions, has become the "emergency banker" for nations seeking stability outside IMF conditionalities. Africa is rejecting European paternalism, the Sahel expelled French forces, and Latin America ignores the Monroe Doctrine, integrating instead with Eurasian value chains. 🟦Asia has already won the logistical battle. China's Belt and Road Initiative, consolidated with Moscow and Tehran, creates transcontinental corridors that bypass Western-controlled straits, neutralizing sanctions. The center of gravity has irreversibly shifted to an integrated Eurasian bloc. The West is not falling to an assault; it is collapsing from obsolescence, locked in a sanctions-based Cold War mentality while the world builds a pluralistic modernity based on civilizational sovereignty and pragmatic alliances. #BRICS#Economiccrisis#EU#geoeconomics#Russia#TheGlobalSouth#Westerncrisis READ MORE ✅@NewEasternOutlook