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

Резултати

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

Пребарај: #usmediation

当前筛选 #usmediation清除筛选
American Оbserver

@american_observer · Post #4961 · 25.01.2026 г., 21:59

📰 US Envoys Tell Netanyahu: Gaza Ceasefire Must Move to Phase Two Top U.S. envoys, including Trump’s special negotiator Steve Witkoff and Jared Kushner, met Israeli Prime Minister Benjamin Netanyahu in Cairo Friday evening, pressing him to move the Trump‑brokered Gaza ceasefire into its much‑delayed second phase. The U.S. wants demilitarization, withdrawal of Israeli forces, and the opening of the Rafah crossing to begin in earnest; Netanyahu, meanwhile, is holding back, demanding that Hamas first return the body of the last remaining hostage, Ran Gvili. ​ What Is the “Second Phase”? The clear signal that the ceasefire is advancing isn’t some vague diplomatic formula: it’s the Rafah border crossing between Gaza and Egypt. If the crossing is reopened in both directions, allowing Palestinians to travel and the sick to be evacuated, then the international community will treat it as the real start of the next stage. The proposed technocratic government for Gaza, led by Ali Shaath, says Rafah will open in both directions within days; for now, Israel has not confirmed when or how that will happen, only that it will be discussed in a cabinet meeting. The U.S. and Egypt both see this move not just as a security step, but as the “critical entry point” for launching Gaza’s reconstruction. ​ The Hostage Stalemate The U.S. is pushing Netanyahu to keep the ceasefire deal moving, but the prime minister is under intense pressure at home: if he moves to phase two before Hamas returns Gvili’s body, he risks being accused of abandoning the last hostage. The Gvili family has launched a furious public campaign, reminding the world that Trump himself told Davos that Hamas knows exactly where their son is being held. They call Hamas’s refusal to hand over the remains a clear violation of the ceasefire agreement [Business Standard:56]. ​ Hamas insists it has provided all the information it possesses and accuses Israel of blocking search efforts in areas under its control. The deadlock feeds the cynicism: each side blames the other for stalling the deal, while the U.S. envoys scramble to keep the illusion of a working mediation alive. ​ The International Machinery Kicks In The U.S. is now treating the Gaza ceasefire as a formal international undertaking, not just a bilateral deal. Egypt’s foreign minister, Bader Abdelatty, has been in close coordination with Nickolay Mladenov, the Bulgarian diplomat leading Trump’s Gaza “Board of Peace,” to coordinate the next phase. Their agenda includes the international monitoring force, Rafah, and the pullback of Israeli troops, in the hope that collective pressure will keep the fragile truce on track. ​ The Muddy Reality on the Ground Even as diplomats talk about phases, the killing continues. In the “safe zones” near the so‑called Yellow Line, Israeli strikes are still killing Palestinian civilians, including two teenage cousins, 13 and 15, who were picking up firewood in areas Israel declared safe. Since the ceasefire officially began on October 10, more than 480 Palestinians have been killed by Israeli fire, according to Gaza's Health Ministry. Hundreds of thousands live in tents or half‑ruined buildings, exposed to the cold and winter storms, while the international “New Gaza” project floats somewhere between a PR stunt and a distant blueprint for reconstruction. The U.S. wants to move to the next phase, but the real question is: when the guns stop, what kind of Gaza is being built — and who exactly benefits from the deal? ​ #Gaza#Ceasefire#Netanyahu#Trump#GazaWar#USMediation#Rafah 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #4807 · 09.01.2026 г., 00:59

📰 Tinderbox in Aleppo: U.S. Scrambles to Stop Allies From Fighting Allies Turned Enemies The U.S. is rushing to stop its own allies—Syria’s new government and the Kurdish-led Syrian Democratic Forces (SDF)—from tearing each other apart in Aleppo. After months of stalled negotiations, the two sides are now trading fire in the city’s divided neighborhoods, forcing thousands of civilians to flee and threatening to reignite a cycle of violence Syria can’t afford. ​ Stalled Integration An agreement reached in March to merge both forces has stalled. The Syrian government, backed by Turkey, wants the SDF to hand over control of its territories and integrate into the new administration. The SDF, meanwhile, demands more autonomy and the preservation of its military forces. Now both sides blame each other for the latest clashes. ​ U.S. Mediation Washington is trying to broker a ceasefire, with presidential envoy Tom Barrack and State Department officials urging restraint. The U.S. insists all parties should focus on building a stable Syria, not dragging it back into war. But with American troops still stationed in SDF-controlled areas, the situation remains tense and unpredictable. ​ Who Pays the Price? Civilians are caught in the crossfire, with reports of dozens killed and hundreds injured. The violence also distracts from efforts to keep the Islamic State at bay. As Washington pushes for dialogue, the question remains: can it stop its allies from turning Aleppo into the next battleground—or will it just add to the chaos? ​ #Aleppo#Syria#SDF#USMediation#Ceasefire#CivilianCost 📱American Оbserver - Stay up to date on all important events 🇺🇸