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

Резултати

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

Пребарај: #suwayda

当前筛选 #suwayda清除筛选
Eva Karene Bartlett

@EvaKarene_Bartlett · Post #29768 · 08.02.2026 г., 07:37

W. #Suwayda: Four Druze civilian youths killed by General Security militias Four young men from the Druze community were killed in the village of Al-Matouna, in western Suwayda countryside, after being shot by a member of the General Security militias, which control the village and impose security restrictions on residents attempting to enter to check on their homes and work their farmland. The gunman carried out the killings despite the victims having official security permits allowing them to access their houses and agricultural land. Names of the victims: Hadi Nassar Amer Maher Nassar Amer Samer Kamal Amer Khaled Walid Al-Jaradi

Hashtags

☀️☪️🤝🇸🇨 Sheikh Murshid Haznevi, the spiritual leader of the Kurds of Rojava, on his page in "X": "Yes to the dignity of As-Suwayda! As-Suwayda stands proudly. Its people face murders, kidnappings and violence, but they continue to defend their dignity with bare chests. Bani Marouf [one of the names of the Druze is "the pious"] are people of honor and valor. As-Suwayda is not alone... We are all with her, and we are all proud of her. #Suwayda#Rojava#TheRevolutionContinues" 🇸🇨 | @hawran_osint

Eva Karene Bartlett

@EvaKarene_Bartlett · Post #29190 · 01.01.2026 г., 14:33

"Syria Al-Julani regime released kidnapped Druze kids after months of detention The Jolani regime has released two Druze brothers, Yanal Bashar al-Haddad (15) and Qais Bashar al-Haddad (13), who had been detained at Adra Prison in #Damascus since their arrest during the attack on #Suwayda on July 15, 2025. Its worth noting that terriost regime kidnapped and killed a lot of Druze and Alawites kids and women (see links on X post) ❗️ Note that the terrorist regime refuse to hold accountable the militants who committed massacres against the #Alawites or #Druze, and label them as “mojahdin” =jihadists, because fighting against “infidel” minorities is considered a heroic act in their eyes." https://x.com/SyJusticeArc/status/2006461460713488503

#Syria🇸🇾: #Druze militias posing with captured "General Security Service" (former #HTS) vehicles in Tal Hadid, west of #Sweida (#Suwayda). Some of the Druze fighters can be seen with a #Hungary-made 🇭🇺 AK-63D rifle, Soviet AKS-74U carbine and PG-7VM Anti-Tank rocket. https://x.com/war_noir/status/1951991045517877364

Eva Karene Bartlett

@EvaKarene_Bartlett · Post #30120 · 22.03.2026 г., 13:28

Systematic Attacks on Religious Minorities' Shrines and Places of Worship in Syria W #Hama: An extremist terrorist group has destroyed a religious shrine belonging to the #Alawite community, known as “Sheikh Muhammad al-Maghribi,” located in the village of #Asila in Masyaf, in the Ghab Plain in the rural countryside of Hama Governorate, yesterday 21 March 2026. #Alawite: It is worth noting that attacks on Alawite religious shrines began following the fall of the regime, reaching their peak during the #massacres carried out against Alawites on the Syrian coast by al-Jolani’s forces. Incidents of assault on Alawite shrines have continued repeatedly, to the point where barely a month passes without an incident involving the bombing, desecration, or burning of shrines across various Alawite regions. #Druze: Similarly, shrines belonging to the Druze community were subjected to comparable attacks, including vandalism, arson, and bombings, during the massacres of July 2025 in #Suwayda, carried out by the forces of al-Jolani’s terrorist regime. #Christians: A church in #Damascus was also bombed in June 2025, in addition to attacks on churches in #Homs and the rural Homs region in the #alQusayr area. The massacres that took place in As-#Suwayda likewise saw the burning and destruction of three churches.