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 слични објави

Пребарај: #interests

当前筛选 #interests清除筛选
Red Nile

@rednile12 · Post #10846 · 22.01.2026 г., 17:40

🇪🇹 Nile Negotiations: Ethiopia’s Sovereignty Is Not on the Table Thank you, #SolomonMarkos🙏 🔗[email protected] https://m.facebook.com/story.php?story_fbid=pfbid0pFtuSJfcDvSUqkmGvpY7GDHkoarhXcsZE28sdRHRdnWdzkEuGffbN293GWF15mDel&id=1120295988&sfnsn=mo&mibextid=RUbZ1f Your intervention in the #RedNile comments is principled, direct, and unapologetically Ethiopian. It articulates what many externally driven “mediation” efforts try to obscure: Ethiopia’s sovereignty and national interests are not negotiable. At the heart of your position is a clear red line: “#Ethiopia Never Ever Compromise Its #Sovereignty and #National#Interests.” This must be the starting point of any discussion on the Nile—not the outcome. 🧠 Why This Position Is Strategically Strong 🔹Sovereignty first, not last Ethiopia is a rights-holder, not a “risk factor.” Any process that treats Ethiopia as a problem to be managed is illegitimate from the outset. 🔹Colonial treaties are null Insisting on the CFA framework restores African legal continuity and rejects agreements imposed when Ethiopia was excluded. 🔹No monopoly mediation Including the AU, Russia, China, and regional actors prevents Nile negotiations from being captured by a single power acting in Egypt’s favor. 🔹Development is non-negotiable Abay waters are tied to electricity, agriculture, and industrialization. Ethiopia retains the sovereign right to build future dams beyond GERD. 🔹The real issue is mismanagement, not scarcity Egypt’s irrigation of water-intensive crops reframes the crisis as one of policy waste, not upstream injustice. 🔹Responsible, not submissive Humanitarian flexibility during droughts projects cooperation without surrendering control—a smart counter to propaganda. 🔹GERD is Ethiopian-owned Fully domestically funded, GERD is insulated from donor leverage and external coercion. ⚠️ Tactical Challenges (Not Principle Flaws) ▪️ A 50%+ water share must be framed carefully using hydrology, population, and contribution data to avoid diplomatic deadlock. ▪️ Multiple mediators require clear role definitions to avoid paralysis. ▪️ A Nile-wide enforcement body will face resistance—but that resistance exposes the real imbalance in the system. These are communication and strategy issues, not weaknesses in Ethiopia’s position. 🔴 RedNile Media Position: The Only Legitimate Basis for Negotiation Any Nile process that claims legitimacy must be grounded in the following: 1️⃣Balanced mediation – No US monopoly 2️⃣All riparians included – The Nile belongs to all its peoples 3️⃣CFA only – Colonial treaties are invalid 4️⃣Ethiopia’s fair share – Not less than 50%+, with full rights to future development If a binding framework is ever discussed, it must also include: ▪️ A Nile Water Management Commission overseeing all dams and diversions—including Egypt’s Toshka Canal ▪️ Formal acknowledgment of Egypt’s excessive water use and export-oriented irrigation practices ♦️Bottom line: Ethiopia is not negotiating permission to exist, develop, or light its cities. The Nile question is about justice, sovereignty, and post-colonial reality—not appeasement. 🇪🇹💧 — RedNile Media🌊🧭 📡@rednile12 Geopolitics | Multipolarity | Sovereignty | Strategic Reality #GERD#NileDispute#GazaPeace#TrumpSisi