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

Пребарај: #rednileanalysis

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

@rednile12 · Post #10572 · 02.01.2026 г., 12:51

🔺Continuation from above @rednile12 📌 2. Immediate Fallout: Tehran Responds Iranian officials framed Trump’s statement as foreign interference, not solidarity: 🔹Ali Larijani: Warned U.S. meddling would destabilize the region and endanger American interests and troops. 🔹Ali Shamkhani: Declared any intervening “hand” would be “cut off,” citing U.S. failures in Iraq, Afghanistan, and Gaza. Tehran continues to distinguish rhetorically between legitimate economic protest and foreign-directed escalation. 📌 3. Context Matters (Brief) The protests did not begin as a political uprising. They originated as economic strikes over currency collapse and inflation, later spreading geographically and socially before escalating. 📎 Full breakdown of protest origins, slogans, and escalation: This distinction matters—because economic anger is now being repurposed. 📌 4. The Bigger Picture: Brian Berletic on Regime-Change Continuity Geopolitical analyst Brian Berletic argues Trump’s statement exposes structural continuity in U.S. policy—not a Trump-specific anomaly. His core argument: The U.S. does not oppose Iran because it threatens the American homeland, but because Iran resists U.S.-Israeli regional dominance. 🔑Key Points from Berletic’s Analysis: 🔹Policy consistency across administrations From Bush to Obama, Trump, Biden, and back to Trump: 🔸Sanctions as economic warfare 🔸Support for opposition networks 🔸Information warfare and narrative control 🔸Threats—or use—of military force 🔹Trump’s record fits the pattern 🔸JCPOA withdrawal (2018) 🔸“Maximum pressure” sanctions 🔸Assassination of Qasem Soleimani (2020) 🔸2025 U.S.-Israeli airstrikes 🔸Now open encouragement of unrest 🔹Think-tank blueprint already exists Berletic points to the Brookings Institution’s “Which Path to Persia?” (2009), which openly discussed: 🔸Exploiting internal unrest 🔸Combining sanctions, media amplification, and proxy pressure 🔸Encouraging “velvet revolution” or Maidan-style collapse Trump’s language simply removes the ambiguity that usually surrounds this strategy. 📌 5. Why Trump’s Statement Is Hybrid Warfare Trump’s threat performs three strategic functions: 1️⃣Internationally legitimizes unrest as a “freedom struggle” 2️⃣Signals to opposition elements that external backing is available 3️⃣Provokes harsher state responses, which are then weaponized in media narratives This is not about protecting protesters—it is about creating escalation pathways. ⚠️ RedNile Conclusion Iran is facing real economic suffering—but that suffering is now being actively weaponized. Trump’s “locked & loaded” statement confirms what yesterday’s analysis warned: The objective is not reform. The objective is directional control of public anger. The struggle is no longer just inside Iran—it is over who shapes the outcome. 🔍Full Iranian Maidan analysis: https://telegra.ph/Irans-Current-Situation-Real-Grievances-External-Exploitation-and-the-Battle-Over-Public-Anger-01-01 #IranProtests#HybridWarfare#RegimeChange#Trump#Maidan#ForeignInterference#Geopolitics#RedNileAnalysis — RedNile Media | Jan 2026

Red Nile

@rednile12 · Post #10422 · 17.12.2025 г., 17:16

🔺Continuation from above @rednile12 🛢️ What’s really driving prices? 🔹Oversupply dominates ▪️US output at a record ~13.8 million bpd ▪️OPEC+ (led by Russia) adding 137,000 bpd in December ▪️IEA warns of a 4+ million bpd surplus in 2026 🔹Venezuela factor is limited (for now) ▪️Venezuela exports ~800–900k bpd (mostly to China) ▪️Blockade mainly targets shadow fleet tankers ▪️Estimated 300–500k bpd at risk ▪️OPEC spare capacity can easily offset this 🔹Demand is weak ▪️Sluggish global growth ▪️China slowdown ▪️Energy transition pressures ⚠️ Strategic takeaway This isn’t about oil fundamentals—it’s about US coercive diplomacy. 🔹 Trump’s move: ▪️Injects short-term volatility ▪️Signals renewed energy weaponization ▪️Uses sanctions + naval pressure, not markets, to discipline rivals 🔹 But in an oversupplied world, geopolitics can only spike prices temporarily. 📉Bottom line: Unless the blockade expands or collides with another major disruption, oil prices remain structurally bearish, with volatility driven by headlines—not fundamentals. 🔴 Follow more insights: @rednile12 | #Red_Nile_Geopolitics #OilPolitics#TrumpDoctrine#Venezuela#EnergyWeaponization#Geopolitics#OPEC#WTI#Brent#GlobalEconomy#RedNileAnalysis