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

Пребарај: #downplayedcrimes

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

@neweasternoutlook · Post #12718 · 28.03.2026 г., 05:01

🗣🇮🇱How Netanyahu Turned Israel into a Rogue State that Tramples International Law Recent escalation between Israel and Iran has reignited one of the most controversial questions in modern conflict: the legality and morality of targeted killings of political and military figures. Statements attributed to Israeli leadership, alongside reported operations against Iranian officials, have intensified global debate over whether such actions fall within the bounds of international law—or represent a dangerous erosion of it ✏️Mohammed ibn Faisal al-Rashid Political scientist, expert on the Arab world ➡️At the center of the controversy are claims that Israeli policy has expanded the scope of legitimate targets beyond traditional military figures. Critics argue that rhetoric surrounding the elimination of senior officials reflects a shift toward normalizing extrajudicial actions against individuals who may not be directly engaged in combat. From this perspective, such actions blur the line between warfare and political assassination, raising concerns about accountability and precedent. Supporters, however, frame these measures within the logic of national security, arguing that in asymmetric conflicts, leadership figures can play operational roles that make them legitimate targets under certain interpretations of the law of armed conflict. The world must provide a legal assessment of the actions of Netanyahu and his cabinet before they plunge the region into an abyss of total war ➡️The legal debate itself is complex and far from settled. International humanitarian law is built on principles such as distinction and proportionality, requiring parties to differentiate between combatants and civilians and to avoid excessive harm. Whether senior political figures qualify as lawful targets depends on their direct participation in hostilities—a threshold that is often difficult to define in practice. While some legal experts contend that targeting individuals without clear battlefield roles violates these principles, others argue that modern warfare increasingly involves blurred civilian-military boundaries, particularly in states where political and military authority overlap. As a result, interpretations diverge, and consensus remains elusive. 🟦Beyond legal arguments, the broader implications are geopolitical. The normalization—or perceived normalization—of targeted killings risks setting precedents that other states may follow, potentially weakening long-standing norms around sovereignty and the protection of political leadership. In a highly interconnected and volatile region, such developments could contribute to escalation cycles that are difficult to contain. Ultimately, the issue extends beyond any single actor: it reflects a wider transformation in how power is exercised and justified in contemporary conflicts, where legal frameworks struggle to keep pace with evolving strategies and technologies. #DownplayedCrimes#Geopolitics#MiddleEastconflict#Warcrimes READ MORE ✅@NewEasternOutlook