@developmentnewsindia · Post #44271 · 01.05.2026 г., 03:23
India among 6 countries placed on US Trade Representative priority watch list. #geopolitics
Hashtags
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
Пребарај: #geopolitics
@developmentnewsindia · Post #44271 · 01.05.2026 г., 03:23
India among 6 countries placed on US Trade Representative priority watch list. #geopolitics
Hashtags
@developmentnewsindia · Post #44262 · 30.04.2026 г., 20:27
🇦🇪⚡🇵🇰 Etihad fires 15 Pakistanis, gives 48-hour exit order: UAE signals tougher stance on Islamabad #Geopolitics https://t.co/hwWqm6bTxX
Hashtags
@developmentnewsindia · Post #44259 · 30.04.2026 г., 18:35
Russian FM Sergey Lavrov to attend BRICS FM Summit in New Delhi from 14-15 May #Geopolitics
Hashtags
@developmentnewsindia · Post #44229 · 30.04.2026 г., 09:53
Indian, Italian Defence ministers agree to Bilateral Military Cooperation Plan (MCP) 2026-27 #Geopolitics
Hashtags
@developmentnewsindia · Post #44184 · 29.04.2026 г., 07:54
Vietnam President To Lam to visit India next week. #Geopolitics
Hashtags
@developmentnewsindia · Post #44163 · 28.04.2026 г., 12:43
India Condemns Terrorists Attacks in Mali #Geopolitics
Hashtags
@developmentnewsindia · Post #44134 · 27.04.2026 г., 16:40
No Consensus among BRICS members on West Asia Conflict : MEA #Geopolitics
Hashtags
@developmentnewsindia · Post #44129 · 27.04.2026 г., 15:02
🇮🇳🤝🇯🇴 Jordan joins India led International Solar Alliance (ISA), the Coalition for Disaster Resilient Infrastructure (CDRI) and the Global Biofuel Alliance (GBA) #Geopolitics
Hashtags
@developmentnewsindia · Post #44088 · 26.04.2026 г., 16:51
Spokesperson of Iran’s National Security Committee, Ebrahim Rezaei, has called Pakistan ‘not a suitable mediator and it lacks credibility and questions its neutrality. #Geopolitics
Hashtags
@developmentnewsindia · Post #44034 · 24.04.2026 г., 15:15
First BRICS statement on West Asia conflict, after BRICS Deputy Foreign Ministers and Special Envoys on the Middle East and North Africa (MENA) meet in New Delhi. #Geopolitics
Hashtags
@developmentnewsindia · Post #44023 · 24.04.2026 г., 13:18
🇺🇳 UNGA President Annalena Baerbock to visit India on April 28th #Geopolitics
Hashtags
@developmentnewsindia · Post #43970 · 23.04.2026 г., 09:43
🇮🇷⚔️🇺🇸Report: Iran Bypasses US Naval Blockade with 34 Tankers According to cargo tracking group Vortexa, at least 34 tankers linked to Iran have successfully bypassed the US naval blockade since its inception. A significant number of these vessels were reportedly transporting Iranian crude oil, a key source of revenue for the regime. Vortexa's data indicates 19 of the vessels exited the Persian Gulf while 15 entered. Analysts suggest the current US Navy deployment is insufficient to fully enforce the blockade line. #Geopolitics
Hashtags